2010-10-12 15:53:47 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2006-09-17 05:17:21 +00:00
|
|
|
|
2000-11-12 14:49:09 +00:00
|
|
|
#include <com/sun/star/util/DateTime.hpp>
|
|
|
|
#include <com/sun/star/text/FilenameDisplayFormat.hpp>
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <com/sun/star/lang/NoSupportException.hpp>
|
|
|
|
#include <com/sun/star/beans/PropertyAttribute.hpp>
|
|
|
|
#include <vcl/svapp.hxx>
|
2010-10-16 03:18:35 -05:00
|
|
|
#include <osl/mutex.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/eeitem.hxx>
|
|
|
|
#include <editeng/flditem.hxx>
|
2010-01-08 18:32:51 +01:00
|
|
|
#include <editeng/measfld.hxx>
|
2010-01-06 19:26:54 +01:00
|
|
|
#include <editeng/unofield.hxx>
|
|
|
|
#include <editeng/unotext.hxx>
|
2011-06-03 21:38:37 +01:00
|
|
|
#include <comphelper/servicehelper.hxx>
|
2013-10-22 23:49:31 -02:00
|
|
|
#include <cppuhelper/supportsservice.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-07 15:22:54 -04:00
|
|
|
#include "editeng/unonames.hxx"
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
using namespace ::cppu;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
|
|
|
|
#define QUERYINT( xint ) \
|
2015-04-01 08:38:49 +02:00
|
|
|
if( rType == cppu::UnoType<xint>::get() ) \
|
2000-09-18 16:07:07 +00:00
|
|
|
aAny <<= uno::Reference< xint >(this)
|
|
|
|
|
|
|
|
|
2000-11-12 14:49:09 +00:00
|
|
|
#define WID_DATE 0
|
2000-10-18 15:10:16 +00:00
|
|
|
#define WID_BOOL1 1
|
|
|
|
#define WID_BOOL2 2
|
2000-11-12 14:49:09 +00:00
|
|
|
#define WID_INT32 3
|
|
|
|
#define WID_INT16 4
|
|
|
|
#define WID_STRING1 5
|
|
|
|
#define WID_STRING2 6
|
|
|
|
#define WID_STRING3 7
|
2000-10-18 15:10:16 +00:00
|
|
|
|
|
|
|
class SvxUnoFieldData_Impl
|
|
|
|
{
|
|
|
|
public:
|
2014-04-09 11:03:42 +02:00
|
|
|
bool mbBoolean1;
|
|
|
|
bool mbBoolean2;
|
2000-11-12 14:49:09 +00:00
|
|
|
sal_Int32 mnInt32;
|
|
|
|
sal_Int16 mnInt16;
|
2000-10-18 15:10:16 +00:00
|
|
|
OUString msString1;
|
|
|
|
OUString msString2;
|
|
|
|
OUString msString3;
|
2000-11-12 14:49:09 +00:00
|
|
|
util::DateTime maDateTime;
|
2000-10-18 15:10:16 +00:00
|
|
|
|
|
|
|
OUString msPresentation;
|
|
|
|
};
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
const SfxItemPropertySet* ImplGetFieldItemPropertySet( sal_Int32 mnId )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aExDateTimeFieldPropertyMap_Impl[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-05-10 00:14:44 +02:00
|
|
|
{ OUString(UNO_TC_PROP_DATE_TIME), WID_DATE, ::cppu::UnoType<util::DateTime>::get(), 0, 0 },
|
2015-04-01 08:38:49 +02:00
|
|
|
{ OUString(UNO_TC_PROP_IS_FIXED), WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_IS_DATE), WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
|
2014-05-10 00:14:44 +02:00
|
|
|
{ OUString(UNO_TC_PROP_NUMFORMAT), WID_INT32, ::cppu::UnoType<sal_Int32>::get(), 0, 0 },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aExDateTimeFieldPropertySet_Impl(aExDateTimeFieldPropertyMap_Impl);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aDateTimeFieldPropertyMap_Impl[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-04-01 08:38:49 +02:00
|
|
|
{ OUString(UNO_TC_PROP_IS_DATE), WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aDateTimeFieldPropertySet_Impl(aDateTimeFieldPropertyMap_Impl);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aUrlFieldPropertyMap_Impl[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
|
2014-05-10 00:14:44 +02:00
|
|
|
{ OUString(UNO_TC_PROP_URL_FORMAT), WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_URL_REPRESENTATION), WID_STRING1, ::cppu::UnoType<OUString>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_URL_TARGET), WID_STRING2, ::cppu::UnoType<OUString>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_URL), WID_STRING3, ::cppu::UnoType<OUString>::get(), 0, 0 },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aUrlFieldPropertySet_Impl(aUrlFieldPropertyMap_Impl);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aEmptyPropertyMap_Impl[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aEmptyPropertySet_Impl(aEmptyPropertyMap_Impl);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aExtFileFieldPropertyMap_Impl[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-04-01 08:38:49 +02:00
|
|
|
{ OUString(UNO_TC_PROP_IS_FIXED), WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
|
2014-05-10 00:14:44 +02:00
|
|
|
{ OUString(UNO_TC_PROP_FILE_FORMAT), WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_CURRENT_PRESENTATION), WID_STRING1, ::cppu::UnoType<OUString>::get(), 0, 0 },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aExtFileFieldPropertySet_Impl(aExtFileFieldPropertyMap_Impl);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aAuthorFieldPropertyMap_Impl[] =
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2015-04-01 08:38:49 +02:00
|
|
|
{ OUString(UNO_TC_PROP_IS_FIXED), WID_BOOL1, cppu::UnoType<bool>::get(), 0, 0 },
|
2014-05-10 00:14:44 +02:00
|
|
|
{ OUString(UNO_TC_PROP_CURRENT_PRESENTATION), WID_STRING1,::cppu::UnoType<OUString>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_AUTHOR_CONTENT), WID_STRING2,::cppu::UnoType<OUString>::get(), 0, 0 },
|
|
|
|
{ OUString(UNO_TC_PROP_AUTHOR_FORMAT), WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
|
2015-04-01 08:38:49 +02:00
|
|
|
{ OUString(UNO_TC_PROP_AUTHOR_FULLNAME), WID_BOOL2, cppu::UnoType<bool>::get(), 0, 0 },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2000-09-18 16:07:07 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aAuthorFieldPropertySet_Impl(aAuthorFieldPropertyMap_Impl);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertyMapEntry aMeasureFieldPropertyMap_Impl[] =
|
2001-02-01 18:00:06 +00:00
|
|
|
{
|
2014-05-10 00:14:44 +02:00
|
|
|
{ OUString(UNO_TC_PROP_MEASURE_KIND), WID_INT16, ::cppu::UnoType<sal_Int16>::get(), 0, 0 },
|
2013-12-11 15:16:51 +01:00
|
|
|
{ OUString(), 0, css::uno::Type(), 0, 0 }
|
2001-02-01 18:00:06 +00:00
|
|
|
};
|
2013-07-27 10:05:44 +09:00
|
|
|
static const SfxItemPropertySet aMeasureFieldPropertySet_Impl(aMeasureFieldPropertyMap_Impl);
|
2001-02-01 18:00:06 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
switch( mnId )
|
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
2012-05-11 01:00:59 -04:00
|
|
|
case text::textfield::Type::DATE:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aExDateTimeFieldPropertySet_Impl;
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::URL:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aUrlFieldPropertySet_Impl;
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::TIME:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aDateTimeFieldPropertySet_Impl;
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aExtFileFieldPropertySet_Impl;
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::AUTHOR:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aAuthorFieldPropertySet_Impl;
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::MEASURE:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aMeasureFieldPropertySet_Impl;
|
2000-10-18 15:10:16 +00:00
|
|
|
default:
|
2009-06-03 11:26:39 +00:00
|
|
|
return &aEmptyPropertySet_Impl;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-12 14:49:09 +00:00
|
|
|
/* conversion routines */
|
|
|
|
|
|
|
|
static sal_Int16 getFileNameDisplayFormat( SvxFileFormat nFormat )
|
|
|
|
{
|
|
|
|
switch( nFormat )
|
|
|
|
{
|
|
|
|
case SVXFILEFORMAT_NAME_EXT: return text::FilenameDisplayFormat::NAME_AND_EXT;
|
|
|
|
case SVXFILEFORMAT_FULLPATH: return text::FilenameDisplayFormat::FULL;
|
|
|
|
case SVXFILEFORMAT_PATH: return text::FilenameDisplayFormat::PATH;
|
|
|
|
// case SVXFILEFORMAT_NAME:
|
|
|
|
default: return text::FilenameDisplayFormat::NAME;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static SvxFileFormat setFileNameDisplayFormat( sal_Int16 nFormat )
|
|
|
|
{
|
|
|
|
switch( nFormat )
|
|
|
|
{
|
|
|
|
case text::FilenameDisplayFormat::FULL: return SVXFILEFORMAT_FULLPATH;
|
|
|
|
case text::FilenameDisplayFormat::PATH: return SVXFILEFORMAT_PATH;
|
|
|
|
case text::FilenameDisplayFormat::NAME: return SVXFILEFORMAT_NAME;
|
|
|
|
// case text::FilenameDisplayFormat::NAME_AND_EXT:
|
|
|
|
default:
|
|
|
|
return SVXFILEFORMAT_NAME_EXT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-13 14:12:48 +01:00
|
|
|
static util::DateTime getDate( sal_uLong nDate )
|
2000-11-12 14:49:09 +00:00
|
|
|
{
|
|
|
|
util::DateTime aDate;
|
|
|
|
memset( &aDate, 0, sizeof( util::DateTime ) );
|
|
|
|
|
|
|
|
Date aTempDate( nDate );
|
|
|
|
|
|
|
|
aDate.Day = aTempDate.GetDay();
|
|
|
|
aDate.Month = aTempDate.GetMonth();
|
|
|
|
aDate.Year = aTempDate.GetYear();
|
|
|
|
|
|
|
|
return aDate;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline Date setDate( util::DateTime& rDate )
|
|
|
|
{
|
|
|
|
return Date( rDate.Day, rDate.Month, rDate.Year );
|
|
|
|
}
|
|
|
|
|
2013-12-09 23:07:44 +01:00
|
|
|
static util::DateTime getTime(sal_Int64 const nTime)
|
2000-11-12 14:49:09 +00:00
|
|
|
{
|
|
|
|
util::DateTime aTime;
|
|
|
|
memset( &aTime, 0, sizeof( util::DateTime ) );
|
|
|
|
|
2014-09-28 15:49:26 +02:00
|
|
|
tools::Time aTempTime( nTime );
|
2000-11-12 14:49:09 +00:00
|
|
|
|
2013-03-17 08:36:26 +01:00
|
|
|
aTime.NanoSeconds = aTempTime.GetNanoSec();
|
2000-11-12 14:49:09 +00:00
|
|
|
aTime.Seconds = aTempTime.GetSec();
|
|
|
|
aTime.Minutes = aTempTime.GetMin();
|
|
|
|
aTime.Hours = aTempTime.GetHour();
|
|
|
|
|
|
|
|
return aTime;
|
|
|
|
}
|
|
|
|
|
2014-09-28 15:49:26 +02:00
|
|
|
inline tools::Time setTime( util::DateTime& rDate )
|
2000-11-12 14:49:09 +00:00
|
|
|
{
|
2015-01-11 13:35:38 +02:00
|
|
|
return tools::Time( rDate );
|
2000-11-12 14:49:09 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// class SvxUnoTextField
|
2014-02-25 18:24:10 +01:00
|
|
|
|
2012-05-10 10:18:01 +01:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class theSvxUnoTextFieldUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextFieldUnoTunnelId> {};
|
|
|
|
}
|
|
|
|
|
|
|
|
const ::com::sun::star::uno::Sequence< sal_Int8 > & SvxUnoTextField::getUnoTunnelId() throw()
|
|
|
|
{
|
|
|
|
return theSvxUnoTextFieldUnoTunnelId::get().getSeq();
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Int64 SAL_CALL SvxUnoTextField::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException, std::exception)
|
2012-05-10 10:18:01 +01:00
|
|
|
{
|
2012-09-29 14:47:11 +02:00
|
|
|
if( rId.getLength() == 16 && 0 == memcmp( getUnoTunnelId().getConstArray(),
|
2012-05-10 10:18:01 +01:00
|
|
|
rId.getConstArray(), 16 ) )
|
|
|
|
{
|
|
|
|
return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_IntPtr>(this));
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
SvxUnoTextField::SvxUnoTextField( sal_Int32 nServiceId ) throw()
|
2006-06-19 16:01:56 +00:00
|
|
|
: OComponentHelper( getMutex() )
|
|
|
|
, mpPropSet(NULL)
|
|
|
|
, mnServiceId(nServiceId)
|
|
|
|
, mpImpl( new SvxUnoFieldData_Impl )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2009-06-03 11:26:39 +00:00
|
|
|
mpPropSet = ImplGetFieldItemPropertySet(mnServiceId);
|
2000-10-18 15:10:16 +00:00
|
|
|
|
2000-11-12 14:49:09 +00:00
|
|
|
memset( &(mpImpl->maDateTime), 0, sizeof( util::DateTime ) );
|
|
|
|
|
|
|
|
switch( nServiceId )
|
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::DATE:
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean2 = true;
|
2000-11-28 16:01:00 +00:00
|
|
|
mpImpl->mnInt32 = SVXDATEFORMAT_STDSMALL;
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean1 = false;
|
2000-11-12 14:49:09 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
|
|
|
case text::textfield::Type::TIME:
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean2 = false;
|
|
|
|
mpImpl->mbBoolean1 = false;
|
2001-05-09 13:31:30 +00:00
|
|
|
mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
|
2000-11-12 14:49:09 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::URL:
|
2001-02-11 13:33:32 +00:00
|
|
|
mpImpl->mnInt16 = SVXURLFORMAT_REPR;
|
2000-11-12 14:49:09 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean1 = false;
|
2000-11-12 14:49:09 +00:00
|
|
|
mpImpl->mnInt16 = text::FilenameDisplayFormat::FULL;
|
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::AUTHOR:
|
2000-11-12 14:49:09 +00:00
|
|
|
mpImpl->mnInt16 = SVXAUTHORFORMAT_FULLNAME;
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean1 = false;
|
|
|
|
mpImpl->mbBoolean2 = true;
|
2000-11-12 14:49:09 +00:00
|
|
|
break;
|
2001-02-01 18:00:06 +00:00
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::MEASURE:
|
2001-02-01 18:00:06 +00:00
|
|
|
mpImpl->mnInt16 = SDRMEASUREFIELD_VALUE;
|
|
|
|
break;
|
|
|
|
|
2000-11-12 14:49:09 +00:00
|
|
|
default:
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean1 = false;
|
|
|
|
mpImpl->mbBoolean2 = false;
|
2000-11-12 14:49:09 +00:00
|
|
|
mpImpl->mnInt32 = 0;
|
|
|
|
mpImpl->mnInt16 = 0;
|
|
|
|
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, const OUString& rPresentation, const SvxFieldData* pData ) throw()
|
2006-06-19 16:01:56 +00:00
|
|
|
: OComponentHelper( getMutex() )
|
|
|
|
, mxAnchor( xAnchor )
|
|
|
|
, mpPropSet(NULL)
|
2012-05-10 20:31:36 -04:00
|
|
|
, mnServiceId(text::textfield::Type::UNSPECIFIED)
|
2006-06-19 16:01:56 +00:00
|
|
|
, mpImpl( new SvxUnoFieldData_Impl )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
DBG_ASSERT(pData, "pFieldData == NULL! [CL]" );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
mpImpl->msPresentation = rPresentation;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
if(pData)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-08 12:55:14 -04:00
|
|
|
mnServiceId = pData->GetClassId();
|
2012-05-10 20:31:36 -04:00
|
|
|
DBG_ASSERT(mnServiceId != text::textfield::Type::UNSPECIFIED, "unknown SvxFieldData! [CL]");
|
|
|
|
if (mnServiceId != text::textfield::Type::UNSPECIFIED)
|
2000-10-18 15:10:16 +00:00
|
|
|
{
|
|
|
|
// extract field properties from data class
|
|
|
|
switch( mnServiceId )
|
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::DATE:
|
2005-01-28 16:26:33 +00:00
|
|
|
{
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean2 = true;
|
2005-01-28 16:26:33 +00:00
|
|
|
// #i35416# for variable date field, don't use invalid "0000-00-00" date,
|
|
|
|
// use current date instead
|
2014-09-30 09:02:35 +02:00
|
|
|
bool bFixed = static_cast<const SvxDateField*>(pData)->GetType() == SVXDATETYPE_FIX;
|
2005-01-28 16:26:33 +00:00
|
|
|
mpImpl->maDateTime = getDate( bFixed ?
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<const SvxDateField*>(pData)->GetFixDate() :
|
2011-12-01 21:03:42 +01:00
|
|
|
Date( Date::SYSTEM ).GetDate() );
|
2014-09-30 09:02:35 +02:00
|
|
|
mpImpl->mnInt32 = static_cast<const SvxDateField*>(pData)->GetFormat();
|
2005-01-28 16:26:33 +00:00
|
|
|
mpImpl->mbBoolean1 = bFixed;
|
|
|
|
}
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::TIME:
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean2 = false;
|
|
|
|
mpImpl->mbBoolean1 = false;
|
2001-11-13 12:31:56 +00:00
|
|
|
mpImpl->mnInt32 = SVXTIMEFORMAT_STANDARD;
|
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
2014-04-09 11:03:42 +02:00
|
|
|
mpImpl->mbBoolean2 = false;
|
2014-09-30 09:02:35 +02:00
|
|
|
mpImpl->maDateTime = getTime( static_cast<const SvxExtTimeField*>(pData)->GetFixTime() );
|
|
|
|
mpImpl->mbBoolean1 = static_cast<const SvxExtTimeField*>(pData)->GetType() == SVXTIMETYPE_FIX;
|
|
|
|
mpImpl->mnInt32 = static_cast<const SvxExtTimeField*>(pData)->GetFormat();
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::URL:
|
2014-09-30 09:02:35 +02:00
|
|
|
mpImpl->msString1 = static_cast<const SvxURLField*>(pData)->GetRepresentation();
|
|
|
|
mpImpl->msString2 = static_cast<const SvxURLField*>(pData)->GetTargetFrame();
|
|
|
|
mpImpl->msString3 = static_cast<const SvxURLField*>(pData)->GetURL();
|
2006-10-12 12:28:10 +00:00
|
|
|
mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<const SvxURLField*>(pData)->GetFormat());
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
2014-09-30 09:02:35 +02:00
|
|
|
mpImpl->msString1 = static_cast<const SvxExtFileField*>(pData)->GetFile();
|
|
|
|
mpImpl->mbBoolean1 = static_cast<const SvxExtFileField*>(pData)->GetType() == SVXFILETYPE_FIX;
|
|
|
|
mpImpl->mnInt16 = getFileNameDisplayFormat(static_cast<const SvxExtFileField*>(pData)->GetFormat());
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::AUTHOR:
|
2014-09-30 09:02:35 +02:00
|
|
|
mpImpl->msString1 = static_cast<const SvxAuthorField*>(pData)->GetFormatted();
|
|
|
|
mpImpl->msString2 = static_cast<const SvxAuthorField*>(pData)->GetFormatted();
|
2006-10-12 12:28:10 +00:00
|
|
|
mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<const SvxAuthorField*>(pData)->GetFormat());
|
|
|
|
mpImpl->mbBoolean1 = static_cast<const SvxAuthorField*>(pData)->GetType() == SVXAUTHORTYPE_FIX;
|
|
|
|
mpImpl->mbBoolean2 = static_cast<const SvxAuthorField*>(pData)->GetFormat() != SVXAUTHORFORMAT_SHORTNAME;
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
2001-02-01 18:00:06 +00:00
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::MEASURE:
|
2014-09-30 09:02:35 +02:00
|
|
|
mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(static_cast<const SdrMeasureField*>(pData)->GetMeasureFieldKind());
|
2001-02-01 18:00:06 +00:00
|
|
|
break;
|
2015-04-08 23:01:14 +02:00
|
|
|
|
|
|
|
default:
|
|
|
|
SAL_WARN("editeng.uno", "Id service unknown: " << mnServiceId);
|
|
|
|
break;
|
2000-10-18 15:10:16 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2000-12-07 12:15:35 +00:00
|
|
|
|
2009-06-03 11:26:39 +00:00
|
|
|
mpPropSet = ImplGetFieldItemPropertySet(mnServiceId);
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SvxUnoTextField::~SvxUnoTextField() throw()
|
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
delete mpImpl;
|
|
|
|
}
|
|
|
|
|
|
|
|
SvxFieldData* SvxUnoTextField::CreateFieldData() const throw()
|
|
|
|
{
|
|
|
|
SvxFieldData* pData = NULL;
|
|
|
|
|
|
|
|
switch( mnServiceId )
|
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::TIME:
|
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
|
|
|
case text::textfield::Type::DATE:
|
2000-10-18 15:10:16 +00:00
|
|
|
{
|
|
|
|
if( mpImpl->mbBoolean2 ) // IsDate?
|
|
|
|
{
|
2000-11-12 14:49:09 +00:00
|
|
|
Date aDate( setDate( mpImpl->maDateTime ) );
|
2000-10-18 15:10:16 +00:00
|
|
|
pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SVXDATETYPE_FIX:SVXDATETYPE_VAR );
|
2000-11-28 16:01:00 +00:00
|
|
|
if( mpImpl->mnInt32 >= SVXDATEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXDATEFORMAT_F )
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<SvxDateField*>(pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 );
|
2000-10-18 15:10:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
if( mnServiceId != text::textfield::Type::TIME && mnServiceId != text::textfield::Type::DATE )
|
2000-10-18 15:10:16 +00:00
|
|
|
{
|
2014-09-28 15:49:26 +02:00
|
|
|
tools::Time aTime( setTime( mpImpl->maDateTime ) );
|
2000-10-18 15:10:16 +00:00
|
|
|
pData = new SvxExtTimeField( aTime, mpImpl->mbBoolean1?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR );
|
|
|
|
|
2000-11-28 16:01:00 +00:00
|
|
|
if( mpImpl->mnInt32 >= SVXTIMEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXTIMEFORMAT_AM_HMSH )
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<SvxExtTimeField*>(pData)->SetFormat( (SvxTimeFormat)mpImpl->mnInt32 );
|
2000-10-18 15:10:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pData = new SvxTimeField();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::URL:
|
2011-12-23 10:25:18 -02:00
|
|
|
pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, !mpImpl->msString1.isEmpty() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL );
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<SvxURLField*>(pData)->SetTargetFrame( mpImpl->msString2 );
|
2000-11-12 14:49:09 +00:00
|
|
|
if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR )
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<SvxURLField*>(pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 );
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::PAGE:
|
2000-10-18 15:10:16 +00:00
|
|
|
pData = new SvxPageField();
|
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::PAGES:
|
2000-10-18 15:10:16 +00:00
|
|
|
pData = new SvxPagesField();
|
|
|
|
break;
|
|
|
|
|
2012-05-14 10:35:45 -04:00
|
|
|
case text::textfield::Type::DOCINFO_TITLE:
|
2000-10-18 15:10:16 +00:00
|
|
|
pData = new SvxFileField();
|
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::TABLE:
|
2000-10-18 15:10:16 +00:00
|
|
|
pData = new SvxTableField();
|
|
|
|
break;
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
2000-10-18 15:10:16 +00:00
|
|
|
{
|
2001-09-20 06:55:29 +00:00
|
|
|
// #92009# pass fixed attribute to constructor
|
|
|
|
pData = new SvxExtFileField( mpImpl->msString1,
|
|
|
|
mpImpl->mbBoolean1 ? SVXFILETYPE_FIX : SVXFILETYPE_VAR,
|
2006-10-12 12:28:10 +00:00
|
|
|
setFileNameDisplayFormat(mpImpl->mnInt16 ) );
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::AUTHOR:
|
2000-10-18 15:10:16 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aContent;
|
2013-09-10 09:51:45 +02:00
|
|
|
OUString aFirstName;
|
|
|
|
OUString aLastName;
|
|
|
|
OUString aEmpty;
|
2000-10-18 15:10:16 +00:00
|
|
|
|
2001-09-20 06:55:29 +00:00
|
|
|
// do we have CurrentPresentation given?
|
|
|
|
// mimic behaviour of writer, which means:
|
|
|
|
// prefer CurrentPresentation over Content
|
|
|
|
// if both are given.
|
2011-12-23 10:25:18 -02:00
|
|
|
if( !mpImpl->msString1.isEmpty() )
|
2001-09-20 06:55:29 +00:00
|
|
|
aContent = mpImpl->msString1;
|
|
|
|
else
|
|
|
|
aContent = mpImpl->msString2;
|
|
|
|
|
|
|
|
sal_Int32 nPos = aContent.lastIndexOf( sal_Char(' '), 0 );
|
2000-10-18 15:10:16 +00:00
|
|
|
if( nPos > 0 )
|
|
|
|
{
|
2001-09-20 06:55:29 +00:00
|
|
|
aFirstName = aContent.copy( 0, nPos );
|
|
|
|
aLastName = aContent.copy( nPos + 1 );
|
2000-10-18 15:10:16 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-09-20 06:55:29 +00:00
|
|
|
aLastName = aContent;
|
2000-10-18 15:10:16 +00:00
|
|
|
}
|
|
|
|
|
2001-09-20 06:55:29 +00:00
|
|
|
// #92009# pass fixed attribute to constructor
|
2004-04-29 15:28:38 +00:00
|
|
|
pData = new SvxAuthorField( aFirstName, aLastName, aEmpty,
|
2001-09-20 06:55:29 +00:00
|
|
|
mpImpl->mbBoolean1 ? SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR );
|
2000-11-12 14:49:09 +00:00
|
|
|
|
|
|
|
if( !mpImpl->mbBoolean2 )
|
|
|
|
{
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<SvxAuthorField*>(pData)->SetFormat( SVXAUTHORFORMAT_SHORTNAME );
|
2000-11-12 14:49:09 +00:00
|
|
|
}
|
|
|
|
else if( mpImpl->mnInt16 >= SVXAUTHORFORMAT_FULLNAME || mpImpl->mnInt16 <= SVXAUTHORFORMAT_SHORTNAME )
|
|
|
|
{
|
2014-09-30 09:02:35 +02:00
|
|
|
static_cast<SvxAuthorField*>(pData)->SetFormat( (SvxAuthorFormat) mpImpl->mnInt16 );
|
2000-11-12 14:49:09 +00:00
|
|
|
}
|
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-05-04 21:58:22 -04:00
|
|
|
case text::textfield::Type::MEASURE:
|
2001-02-01 18:00:06 +00:00
|
|
|
{
|
|
|
|
SdrMeasureFieldKind eKind = SDRMEASUREFIELD_VALUE;
|
|
|
|
if( mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_UNIT || mpImpl->mnInt16 == (sal_Int16)SDRMEASUREFIELD_ROTA90BLANCS )
|
|
|
|
eKind = (SdrMeasureFieldKind) mpImpl->mnInt16;
|
|
|
|
pData = new SdrMeasureField( eKind);
|
|
|
|
break;
|
|
|
|
}
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_HEADER:
|
2004-03-30 14:40:42 +00:00
|
|
|
pData = new SvxHeaderField();
|
|
|
|
break;
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_FOOTER:
|
2004-03-30 14:40:42 +00:00
|
|
|
pData = new SvxFooterField();
|
|
|
|
break;
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_DATE_TIME:
|
2004-03-30 14:40:42 +00:00
|
|
|
pData = new SvxDateTimeField();
|
|
|
|
break;
|
2015-05-15 13:38:07 +02:00
|
|
|
case text::textfield::Type::PAGE_NAME:
|
2015-04-17 11:06:44 +02:00
|
|
|
pData = new SvxPageTitleField();
|
|
|
|
break;
|
2000-10-18 15:10:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
return pData;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// uno::XInterface
|
|
|
|
uno::Any SAL_CALL SvxUnoTextField::queryAggregation( const uno::Type & rType )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
uno::Any aAny;
|
|
|
|
|
|
|
|
QUERYINT( beans::XPropertySet );
|
|
|
|
else QUERYINT( text::XTextContent );
|
|
|
|
else QUERYINT( text::XTextField );
|
|
|
|
else QUERYINT( lang::XServiceInfo );
|
2000-10-18 15:10:16 +00:00
|
|
|
else QUERYINT( lang::XUnoTunnel );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
|
|
|
return OComponentHelper::queryAggregation( rType );
|
|
|
|
|
|
|
|
return aAny;
|
|
|
|
}
|
|
|
|
|
|
|
|
// XTypeProvider
|
|
|
|
|
|
|
|
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextField::getTypes()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
if( maTypeSequence.getLength() == 0 )
|
|
|
|
{
|
2002-10-01 12:43:00 +00:00
|
|
|
maTypeSequence = OComponentHelper::getTypes();
|
2000-09-18 16:07:07 +00:00
|
|
|
sal_Int32 nOldCount = maTypeSequence.getLength();
|
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
maTypeSequence.realloc( nOldCount + 4 ); // !DANGER! keep this updated
|
2000-09-18 16:07:07 +00:00
|
|
|
uno::Type* pTypes = &maTypeSequence.getArray()[nOldCount];
|
|
|
|
|
2014-05-22 23:19:05 +02:00
|
|
|
*pTypes++ = cppu::UnoType<text::XTextField>::get();
|
|
|
|
*pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
|
|
|
|
*pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
|
|
|
|
*pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
return maTypeSequence;
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextField::getImplementationId()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw (uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2014-03-10 14:26:24 +01:00
|
|
|
return css::uno::Sequence<sal_Int8>();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxUnoTextField::queryInterface( const uno::Type & rType )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
return OComponentHelper::queryInterface(rType);
|
|
|
|
}
|
|
|
|
|
2001-10-17 08:49:07 +00:00
|
|
|
void SAL_CALL SvxUnoTextField::acquire() throw( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OComponentHelper::acquire();
|
|
|
|
}
|
|
|
|
|
2001-10-17 08:49:07 +00:00
|
|
|
void SAL_CALL SvxUnoTextField::release() throw( )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OComponentHelper::release();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Interface text::XTextField
|
|
|
|
OUString SAL_CALL SvxUnoTextField::getPresentation( sal_Bool bShowCommand )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2012-05-10 19:49:05 -04:00
|
|
|
if (bShowCommand)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-10 19:49:05 -04:00
|
|
|
switch (mnServiceId)
|
|
|
|
{
|
|
|
|
case text::textfield::Type::DATE:
|
|
|
|
return OUString("Date");
|
|
|
|
case text::textfield::Type::URL:
|
|
|
|
return OUString("URL");
|
|
|
|
case text::textfield::Type::PAGE:
|
|
|
|
return OUString("Page");
|
|
|
|
case text::textfield::Type::PAGES:
|
|
|
|
return OUString("Pages");
|
|
|
|
case text::textfield::Type::TIME:
|
|
|
|
return OUString("Time");
|
2012-05-14 10:35:45 -04:00
|
|
|
case text::textfield::Type::DOCINFO_TITLE:
|
2012-05-10 19:49:05 -04:00
|
|
|
return OUString("File");
|
|
|
|
case text::textfield::Type::TABLE:
|
|
|
|
return OUString("Table");
|
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
|
|
|
return OUString("ExtTime");
|
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
|
|
|
return OUString("ExtFile");
|
|
|
|
case text::textfield::Type::AUTHOR:
|
|
|
|
return OUString("Author");
|
|
|
|
case text::textfield::Type::MEASURE:
|
|
|
|
return OUString("Measure");
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_HEADER:
|
2012-05-10 19:49:05 -04:00
|
|
|
return OUString("Header");
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_FOOTER:
|
2012-05-10 19:49:05 -04:00
|
|
|
return OUString("Footer");
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_DATE_TIME:
|
2012-05-10 19:49:05 -04:00
|
|
|
return OUString("DateTime");
|
2015-05-15 13:38:07 +02:00
|
|
|
case text::textfield::Type::PAGE_NAME:
|
|
|
|
return OUString("PageName");
|
2012-05-10 19:49:05 -04:00
|
|
|
default:
|
|
|
|
return OUString("Unknown");
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
return mpImpl->msPresentation;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Interface text::XTextContent
|
|
|
|
void SAL_CALL SvxUnoTextField::attach( const uno::Reference< text::XTextRange >& xTextRange )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(lang::IllegalArgumentException, uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xTextRange );
|
|
|
|
if(pRange == NULL)
|
|
|
|
throw lang::IllegalArgumentException();
|
|
|
|
|
|
|
|
SvxFieldData* pData = CreateFieldData();
|
|
|
|
if( pData )
|
|
|
|
pRange->attachField( pData );
|
|
|
|
|
|
|
|
delete pData;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextField::getAnchor()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
return mxAnchor;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// lang::XComponent
|
|
|
|
void SAL_CALL SvxUnoTextField::dispose()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OComponentHelper::dispose();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SvxUnoTextField::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OComponentHelper::addEventListener(xListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SvxUnoTextField::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
|
|
|
OComponentHelper::removeEventListener(aListener);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Interface beans::XPropertySet
|
|
|
|
uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextField::getPropertySetInfo( )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2000-10-18 15:10:16 +00:00
|
|
|
return mpPropSet->getPropertySetInfo();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SAL_CALL SvxUnoTextField::setPropertyValue( const OUString& aPropertyName, const uno::Any& aValue )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
if( mpImpl == NULL )
|
2000-09-18 16:07:07 +00:00
|
|
|
throw uno::RuntimeException();
|
|
|
|
|
2012-05-07 15:22:54 -04:00
|
|
|
if (aPropertyName == UNO_TC_PROP_ANCHOR)
|
|
|
|
{
|
|
|
|
aValue >>= mxAnchor;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-01-05 21:30:06 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( aPropertyName );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pMap )
|
2000-10-18 15:10:16 +00:00
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
|
|
|
|
switch( pMap->nWID )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2000-11-12 14:49:09 +00:00
|
|
|
case WID_DATE:
|
|
|
|
if(aValue >>= mpImpl->maDateTime)
|
2000-10-18 15:10:16 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case WID_BOOL1:
|
|
|
|
if(aValue >>= mpImpl->mbBoolean1)
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case WID_BOOL2:
|
|
|
|
if(aValue >>= mpImpl->mbBoolean2)
|
|
|
|
return;
|
|
|
|
break;
|
2000-11-12 14:49:09 +00:00
|
|
|
case WID_INT16:
|
|
|
|
if(aValue >>= mpImpl->mnInt16)
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case WID_INT32:
|
|
|
|
if(aValue >>= mpImpl->mnInt32)
|
2000-10-18 15:10:16 +00:00
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case WID_STRING1:
|
|
|
|
if(aValue >>= mpImpl->msString1)
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case WID_STRING2:
|
|
|
|
if(aValue >>= mpImpl->msString2)
|
|
|
|
return;
|
|
|
|
break;
|
|
|
|
case WID_STRING3:
|
|
|
|
if(aValue >>= mpImpl->msString3)
|
|
|
|
return;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
throw lang::IllegalArgumentException();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any SAL_CALL SvxUnoTextField::getPropertyValue( const OUString& PropertyName )
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2010-10-13 02:47:36 -05:00
|
|
|
SolarMutexGuard aGuard;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2012-05-07 15:22:54 -04:00
|
|
|
if (PropertyName == UNO_TC_PROP_ANCHOR)
|
|
|
|
return uno::makeAny(mxAnchor);
|
|
|
|
|
2012-05-07 18:04:12 -04:00
|
|
|
if (PropertyName == UNO_TC_PROP_TEXTFIELD_TYPE)
|
|
|
|
return uno::makeAny(mnServiceId);
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
uno::Any aValue;
|
|
|
|
|
2012-01-05 21:30:06 +00:00
|
|
|
const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMap().getByName( PropertyName );
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( !pMap )
|
2000-10-18 15:10:16 +00:00
|
|
|
throw beans::UnknownPropertyException();
|
|
|
|
|
|
|
|
switch( pMap->nWID )
|
|
|
|
{
|
2000-11-12 14:49:09 +00:00
|
|
|
case WID_DATE:
|
|
|
|
aValue <<= mpImpl->maDateTime;
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
case WID_BOOL1:
|
|
|
|
aValue <<= mpImpl->mbBoolean1;
|
|
|
|
break;
|
|
|
|
case WID_BOOL2:
|
|
|
|
aValue <<= mpImpl->mbBoolean2;
|
|
|
|
break;
|
2000-11-12 14:49:09 +00:00
|
|
|
case WID_INT16:
|
|
|
|
aValue <<= mpImpl->mnInt16;
|
|
|
|
break;
|
|
|
|
case WID_INT32:
|
|
|
|
aValue <<= mpImpl->mnInt32;
|
2000-10-18 15:10:16 +00:00
|
|
|
break;
|
|
|
|
case WID_STRING1:
|
|
|
|
aValue <<= mpImpl->msString1;
|
|
|
|
break;
|
|
|
|
case WID_STRING2:
|
|
|
|
aValue <<= mpImpl->msString2;
|
|
|
|
break;
|
|
|
|
case WID_STRING3:
|
|
|
|
aValue <<= mpImpl->msString3;
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2000-10-18 15:10:16 +00:00
|
|
|
return aValue;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
void SAL_CALL SvxUnoTextField::addPropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
|
|
|
|
void SAL_CALL SvxUnoTextField::removePropertyChangeListener( const OUString&, const uno::Reference< beans::XPropertyChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
|
|
|
|
void SAL_CALL SvxUnoTextField::addVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
|
|
|
|
void SAL_CALL SvxUnoTextField::removeVetoableChangeListener( const OUString&, const uno::Reference< beans::XVetoableChangeListener >& ) throw(::com::sun::star::beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException, std::exception) {}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// OComponentHelper
|
|
|
|
void SvxUnoTextField::disposing()
|
|
|
|
{
|
2000-10-18 15:10:16 +00:00
|
|
|
// nothing to do
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// lang::XServiceInfo
|
2014-02-25 21:31:58 +01:00
|
|
|
OUString SAL_CALL SvxUnoTextField::getImplementationName() throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-29 21:35:26 -05:00
|
|
|
return OUString("SvxUnoTextField");
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Sequence< OUString > SAL_CALL SvxUnoTextField::getSupportedServiceNames()
|
2014-02-25 21:31:58 +01:00
|
|
|
throw(uno::RuntimeException, std::exception)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2012-05-10 19:34:00 -04:00
|
|
|
uno::Sequence<OUString> aSeq(4);
|
2000-10-18 15:10:16 +00:00
|
|
|
OUString* pServices = aSeq.getArray();
|
2012-05-10 19:34:00 -04:00
|
|
|
pServices[0] = "com.sun.star.text.TextContent";
|
|
|
|
pServices[1] = "com.sun.star.text.TextField";
|
|
|
|
|
|
|
|
switch (mnServiceId)
|
|
|
|
{
|
|
|
|
case text::textfield::Type::DATE:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.DateTime";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.DateTime";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::URL:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.URL";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.URL";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::PAGE:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.PageNumber";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.PageNumber";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::PAGES:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.PageCount";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.PageCount";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::TIME:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.DateTime";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.DateTime";
|
|
|
|
break;
|
2012-05-14 10:35:45 -04:00
|
|
|
case text::textfield::Type::DOCINFO_TITLE:
|
2012-05-10 19:34:00 -04:00
|
|
|
pServices[2] = "com.sun.star.text.TextField.docinfo.Title";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.docinfo.Title";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::TABLE:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.SheetName";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.SheetName";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::EXTENDED_TIME:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.DateTime";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.DateTime";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::EXTENDED_FILE:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.FileName";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.FileName";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::AUTHOR:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.Author";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.Author";
|
|
|
|
break;
|
|
|
|
case text::textfield::Type::MEASURE:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.Measure";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.Measure";
|
|
|
|
break;
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_HEADER:
|
2012-05-10 19:34:00 -04:00
|
|
|
pServices[2] = "com.sun.star.presentation.TextField.Header";
|
|
|
|
pServices[3] = "com.sun.star.presentation.textfield.Header";
|
|
|
|
break;
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_FOOTER:
|
2012-05-10 19:34:00 -04:00
|
|
|
pServices[2] = "com.sun.star.presentation.TextField.Footer";
|
|
|
|
pServices[3] = "com.sun.star.presentation.textfield.Footer";
|
|
|
|
break;
|
2012-05-11 01:53:46 -04:00
|
|
|
case text::textfield::Type::PRESENTATION_DATE_TIME:
|
2012-05-10 19:34:00 -04:00
|
|
|
pServices[2] = "com.sun.star.presentation.TextField.DateTime";
|
|
|
|
pServices[3] = "com.sun.star.presentation.textfield.DateTime";
|
|
|
|
break;
|
2015-05-15 13:38:07 +02:00
|
|
|
case text::textfield::Type::PAGE_NAME:
|
|
|
|
pServices[2] = "com.sun.star.text.TextField.PageName";
|
|
|
|
pServices[3] = "com.sun.star.text.textfield.PageName";
|
2015-04-17 11:06:44 +02:00
|
|
|
break;
|
2012-05-10 19:34:00 -04:00
|
|
|
default:
|
|
|
|
aSeq.realloc(0);
|
|
|
|
}
|
2000-10-18 15:10:16 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
return aSeq;
|
|
|
|
}
|
|
|
|
|
2014-02-25 21:31:58 +01:00
|
|
|
sal_Bool SAL_CALL SvxUnoTextField::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException, std::exception )
|
2000-10-18 15:10:16 +00:00
|
|
|
{
|
2013-10-22 23:49:31 -02:00
|
|
|
return cppu::supportsService( this, ServiceName );
|
2000-10-18 15:10:16 +00:00
|
|
|
}
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
uno::Reference< uno::XInterface > SAL_CALL SvxUnoTextCreateTextField( const OUString& ServiceSpecifier ) throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
|
|
|
uno::Reference< uno::XInterface > xRet;
|
|
|
|
|
2012-05-29 21:35:26 -05:00
|
|
|
const OUString aTextFieldPrexit( "com.sun.star.text.textfield." );
|
2009-12-10 19:15:53 +01:00
|
|
|
|
|
|
|
// #i93308# up to OOo 3.2 we used this wrong namespace name with the capital T & F. This is
|
|
|
|
// fixed since OOo 3.2 but for compatibility we will still provide support for the wrong notation.
|
2012-05-29 21:35:26 -05:00
|
|
|
const OUString aTextFieldPrexit2( "com.sun.star.text.TextField." );
|
2009-12-10 19:15:53 +01:00
|
|
|
|
2013-03-08 12:37:15 +01:00
|
|
|
if( (ServiceSpecifier.startsWith( aTextFieldPrexit )) ||
|
|
|
|
(ServiceSpecifier.startsWith( aTextFieldPrexit2 )) )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
|
|
|
OUString aFieldType( ServiceSpecifier.copy( aTextFieldPrexit.getLength() ) );
|
|
|
|
|
2012-05-10 20:31:36 -04:00
|
|
|
sal_Int32 nId = text::textfield::Type::UNSPECIFIED;
|
2009-12-10 19:15:53 +01:00
|
|
|
|
2012-04-06 15:05:52 +02:00
|
|
|
if ( aFieldType == "DateTime" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::DATE;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "URL" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::URL;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "PageNumber" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::PAGE;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "PageCount" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::PAGES;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "SheetName" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::TABLE;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "FileName" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::EXTENDED_FILE;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2013-11-21 15:52:45 +02:00
|
|
|
else if (aFieldType == "docinfo.Title" ||
|
|
|
|
aFieldType == "DocInfo.Title" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-14 10:35:45 -04:00
|
|
|
nId = text::textfield::Type::DOCINFO_TITLE;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "Author" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::AUTHOR;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2012-04-06 15:05:52 +02:00
|
|
|
else if ( aFieldType == "Measure" )
|
2009-12-10 19:15:53 +01:00
|
|
|
{
|
2012-05-04 21:58:22 -04:00
|
|
|
nId = text::textfield::Type::MEASURE;
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
2000-10-18 15:10:16 +00:00
|
|
|
|
2012-05-10 20:31:36 -04:00
|
|
|
if (nId != text::textfield::Type::UNSPECIFIED)
|
2015-06-08 16:24:44 +02:00
|
|
|
xRet = static_cast<cppu::OWeakObject *>(new SvxUnoTextField( nId ));
|
2009-12-10 19:15:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return xRet;
|
|
|
|
}
|
2010-10-12 15:53:47 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|