diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-10-09 12:22:23 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-11-06 11:58:16 +0000 |
commit | 44cfc7cb6533d827fd2d6e586d92c61d7d7f7a70 (patch) | |
tree | cfca2fb5cd4676d7d55648fe11105753c2178d5d /svx | |
parent | eff92f2501cf070cd912508b2ccc3c0108d0327c (diff) |
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.
Diffstat (limited to 'svx')
40 files changed, 1455 insertions, 1093 deletions
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index ec1b98f5bc0d..486d4cca2b14 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -249,6 +249,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/sdr/properties/e3dcompoundproperties \ svx/source/sdr/properties/oleproperties \ svx/source/svdraw/clonelist \ + svx/source/svdraw/charthelper \ svx/source/svdraw/gradtrns \ svx/source/svdraw/polypolygoneditor \ svx/source/svdraw/sdrhittesthelper \ diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk index 392dcab57e26..62c13f87a6d1 100644 --- a/svx/Package_inc.mk +++ b/svx/Package_inc.mk @@ -57,6 +57,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/ucsubset.hxx,svx/ucsubset.hxx) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sderitm.hxx,svx/sderitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/obj3d.hxx,svx/obj3d.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/dbcharsethelper.hxx,svx/dbcharsethelper.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/charthelper.hxx,svx/charthelper.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdangitm.hxx,svx/sdangitm.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/grfcrop.hxx,svx/grfcrop.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxtraitm.hxx,svx/sxtraitm.hxx)) @@ -401,6 +402,7 @@ $(eval $(call gb_Package_add_file,svx_inc,inc/svx/svxgrahicitem.hxx,svx/svxgrahi $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xflbstit.hxx,svx/xflbstit.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/galbrws.hxx,svx/galbrws.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/unomod.hxx,svx/unomod.hxx)) +$(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlncapit.hxx,svx/xlncapit.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/xlnclit.hxx,svx/xlnclit.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/deflt3d.hxx,svx/deflt3d.hxx)) $(eval $(call gb_Package_add_file,svx_inc,inc/svx/e3dundo.hxx,svx/e3dundo.hxx)) diff --git a/svx/inc/svx/charthelper.hxx b/svx/inc/svx/charthelper.hxx new file mode 100644 index 000000000000..3b43c4bb7f10 --- /dev/null +++ b/svx/inc/svx/charthelper.hxx @@ -0,0 +1,52 @@ +/* + * 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 . + */ + +#ifndef CHARTHELPER_HXX +#define CHARTHELPER_HXX + +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <basegfx/range/b2drange.hxx> +#include <svx/svxdllapi.h> +#include <drawinglayer/primitive2d/baseprimitive2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +namespace svt { class EmbeddedObjectRef; } + +////////////////////////////////////////////////////////////////////////////// + +class SVX_DLLPUBLIC ChartHelper +{ +public: + // test if given reference is a chart + static bool IsChart(const svt::EmbeddedObjectRef& xObjRef); + + // try to access rXModel in case of a chart to to get the chart content + // as sequence of primitives. Return range of primitives (chart size) in rRange; + // it will be used to embed the chart to the SdrObject transformation. This + // allows to define possible distances between chart and SDrObject bounds here + static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel, + basegfx::B2DRange& rRange); +}; + +////////////////////////////////////////////////////////////////////////////// + +#endif //CHARTHELPER_HXX diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc index d5fa1b3bee1b..714106525ffa 100644 --- a/svx/inc/svx/dialogs.hrc +++ b/svx/inc/svx/dialogs.hrc @@ -1,29 +1,21 @@ -/************************************************************************* +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _SVX_DIALOGS_HRC #define _SVX_DIALOGS_HRC @@ -466,6 +458,11 @@ #define RID_SVXSTR_TBLAFMT_YELLOW (RID_SVX_START + 575) #define RID_SVXSTR_TBLAFMT_END (RID_SVX_START + 576) +// string resources for XLineCap item +#define RID_SVXSTR_LINECAP_BUTT (RID_SVX_START + 586 ) +#define RID_SVXSTR_LINECAP_ROUND (RID_SVX_START + 587 ) +#define RID_SVXSTR_LINECAP_SQUARE (RID_SVX_START + 588 ) + // string resources for XLineJoint item #define RID_SVXSTR_LINEJOINT_NONE RID_SVXSTR_NONE #define RID_SVXSTR_LINEJOINT_MIDDLE (RID_SVX_START + 589 ) @@ -1030,3 +1027,5 @@ #define RID_SVXSTR_DOC_LOAD (SVX_OOO_BUILD_START + 6) #endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/msdffdef.hxx b/svx/inc/svx/msdffdef.hxx index 016197f83dc4..e0b1b10aeede 100644 --- a/svx/inc/svx/msdffdef.hxx +++ b/svx/inc/svx/msdffdef.hxx @@ -1,35 +1,25 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _MSDFFDEF_HXX #define _MSDFFDEF_HXX - #include <tools/solar.h> #include <tools/stream.hxx> #include <tools/gen.hxx> @@ -579,6 +569,9 @@ enum DFF_TextHeader { #define DFF_PBit_Hidden 0x00000002 #define DFF_PBit_Print 0x00000001 +// properties of the second property set +#define DFF_Prop_metroBlob 937 // XML ZipPackage* + //--------------------------------------------------------------------------- // linchpin: the shape type //--------------------------------------------------------------------------- diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx index 3581179a3204..fb97f3e49884 100644 --- a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx +++ b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx @@ -1,35 +1,27 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _SDR_CONTACT_VIEWCONTACTOFSDROLE2OBJ_HXX #define _SDR_CONTACT_VIEWCONTACTOFSDROLE2OBJ_HXX #include <svx/sdr/contact/viewcontactofsdrrectobj.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> ////////////////////////////////////////////////////////////////////////////// // predeclarations @@ -57,6 +49,9 @@ namespace sdr return (SdrOle2Obj&)GetSdrObject(); } + /// helper to create transformation from SdrObject + basegfx::B2DHomMatrix createObjectTransform() const; + // basic constructor, used from SdrObject. explicit ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj); virtual ~ViewContactOfSdrOle2Obj(); diff --git a/svx/inc/svx/svdobj.hxx b/svx/inc/svx/svdobj.hxx index 6c5b67b05f02..ed32170d36db 100644 --- a/svx/inc/svx/svdobj.hxx +++ b/svx/inc/svx/svdobj.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _SVDOBJ_HXX #define _SVDOBJ_HXX @@ -932,7 +923,13 @@ public: // Bei der Konvertierung von TextObj nach PathObj wird es wohl so sein, // dass beide Modi (bLineToArea=true/false) identisch sind. // Defaulted sind diese Methoden auf "Ich kann das nicht" (FALSE/NULL). - virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const; + virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier /*, bool bAddText */) const; +#ifdef FIXME_REMOVE_WHEN_RE_BASE_COMPLETE + SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const + { + return DoConvertToPolyObj(sal_Bool bBezier); + } +#endif SdrObject* ConvertToPolyObj(bool bBezier, bool bLineToArea) const; // convert this path object to contour object; bForceLineDash converts even diff --git a/svx/inc/svx/svdograf.hxx b/svx/inc/svx/svdograf.hxx index eb2235f995e3..77db13a75521 100644 --- a/svx/inc/svx/svdograf.hxx +++ b/svx/inc/svx/svdograf.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _SVDOGRAF_HXX #define _SVDOGRAF_HXX @@ -106,6 +97,7 @@ private: rtl::OUString aFileName; // Wenn es sich um einen Link handelt, steht hier der Dateiname drin. rtl::OUString aFilterName; GraphicObject* pGraphic; // Zur Beschleunigung von Bitmapausgaben, besonders von gedrehten. + GraphicObject* mpReplacementGraphic; SdrGraphicLink* pGraphicLink; // Und hier noch ein Pointer fuer gelinkte Grafiken bool bMirrored:1; // True bedeutet, die Grafik ist horizontal, d.h. ueber die Y-Achse gespiegelt auszugeben. @@ -135,6 +127,7 @@ public: void SetGraphicObject( const GraphicObject& rGrfObj ); const GraphicObject& GetGraphicObject(bool bForceSwapIn = false) const; + const GraphicObject* GetReplacementGraphicObject() const; void NbcSetGraphic(const Graphic& rGrf); void SetGraphic(const Graphic& rGrf); @@ -148,8 +141,6 @@ public: // Keep ATM for SD. bool IsAnimated() const; bool IsEPS() const; - bool IsRenderGraphic() const; - bool HasRenderGraphic() const; bool IsSwappedOut() const; const MapMode& GetGrafPrefMapMode() const; @@ -200,7 +191,14 @@ public: virtual void SetPage(SdrPage* pNewPage); virtual void SetModel(SdrModel* pNewModel); - virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier) const; + bool isEmbeddedSvg() const; + GDIMetaFile getMetafileFromEmbeddedSvg() const; + +#ifdef FIXME_REMOVE_WHEN_RE_BASE_COMPLETE + virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const +#else + virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier /*, bool bAddText */) const; +#endif virtual void AdjustToMaxRect( const Rectangle& rMaxRect, bool bShrinkOnly = false ); diff --git a/svx/inc/svx/svdstr.hrc b/svx/inc/svx/svdstr.hrc index e23cfbad5853..a78d88dfdb2d 100644 --- a/svx/inc/svx/svdstr.hrc +++ b/svx/inc/svx/svdstr.hrc @@ -1,29 +1,21 @@ -/************************************************************************* +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #define SDR_ResourceBegin 2560 @@ -183,7 +175,13 @@ #define STR_ObjNameSingulFONTWORK (STR_ObjNameBegin+145) #define STR_ObjNamePluralFONTWORK (STR_ObjNameBegin+146) -#define STR_ObjNameEnd (STR_ObjNamePluralFONTWORK) + +// Svg support +#define STR_ObjNameSingulGRAFSVG (STR_ObjNameBegin + 147) +#define STR_ObjNamePluralGRAFSVG (STR_ObjNameBegin + 148) + +#define STR_ObjNameEnd (STR_ObjNamePluralGRAFSVG) + #define STR_EditBegin (STR_ObjNameEnd+1) #define STR_EditWithCopy (STR_EditBegin + 0) #define STR_EditPosSize (STR_EditBegin + 1) @@ -716,3 +714,5 @@ #define STR_TABLE_STYLE (SIP_Begin + 274) #define STR_TABLE_STYLE_SETTINGS (SIP_Begin + 275) #define SIP_SA_CROP_MARKERS (SIP_Begin + 276) + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/inc/svx/svdxcgv.hxx b/svx/inc/svx/svdxcgv.hxx index 30fe9df55e14..4918df0c16ad 100644 --- a/svx/inc/svx/svdxcgv.hxx +++ b/svx/inc/svx/svdxcgv.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _SVDXCGV_HXX #define _SVDXCGV_HXX @@ -73,11 +64,11 @@ public: // Alle markierten Objekte in ein Metafile stecken. Z.Zt. noch etwas // buggee (Offset..., Fremdgrafikobjekte (SdrGrafObj), Virtuelle // Objektkopien (SdrVirtObj) mit Ankerpos<>(0,0)). - virtual GDIMetaFile GetMarkedObjMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const; + GDIMetaFile GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked = false) const; // Alle markierten Objekte auf eine Bitmap malen. Diese hat die Farbtiefe // und Aufloesung des Bildschirms. - virtual Bitmap GetMarkedObjBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const; + BitmapEx GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked = false) const; // Alle markierten Objekte in ein neues Model kopieren. Dieses neue Model // hat dann genau eine Page. Das Flag PageNotValid an diesem Model ist @@ -91,8 +82,6 @@ public: // der Default-Layer zugewiesen (Layer 0, (dokumentglobaler Standardlayer). virtual SdrModel* GetMarkedObjModel() const; - GDIMetaFile GetAllMarkedMetaFile(sal_Bool bNoVDevIfOneMtfMarked=sal_False) const { return GetMarkedObjMetaFile(bNoVDevIfOneMtfMarked); } - Bitmap GetAllMarkedBitmap(sal_Bool bNoVDevIfOneBmpMarked=sal_False) const { return GetMarkedObjBitmap(bNoVDevIfOneBmpMarked); } Graphic GetAllMarkedGraphic() const; SdrModel* GetAllMarkedModel() const { return GetMarkedObjModel(); } diff --git a/svx/inc/svx/unoshprp.hxx b/svx/inc/svx/unoshprp.hxx index 8fee2c1165be..1d4f72cfb06d 100644..100755 --- a/svx/inc/svx/unoshprp.hxx +++ b/svx/inc/svx/unoshprp.hxx @@ -1,30 +1,22 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ + #ifndef _SVX_UNOSHPRP_HXX #define _SVX_UNOSHPRP_HXX @@ -37,6 +29,7 @@ #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/drawing/Hatch.hpp> #include <com/sun/star/drawing/FillStyle.hpp> +#include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/drawing/LineStyle.hpp> @@ -129,6 +122,9 @@ #define OWN_ATTR_TRANSFORMATION (OWN_ATTR_VALUE_START+46) #define OWN_ATTR_BASE_GEOMETRY (OWN_ATTR_VALUE_START+47) +/// reuse attr slots for GraphicObject which will never be used together with graphic object +#define OWN_ATTR_REPLACEMENTGRAFURL (OWN_ATTR_VALUE_START+14) + #define OWN_ATTR_APPLET_DOCBASE (OWN_ATTR_VALUE_START+48) #define OWN_ATTR_APPLET_CODEBASE (OWN_ATTR_VALUE_START+49) #define OWN_ATTR_APPLET_NAME (OWN_ATTR_VALUE_START+50) @@ -216,6 +212,7 @@ { MAP_CHAR_LEN(UNO_NAME_SHADOWYDIST), SDRATTR_SHADOWYDIST, &::getCppuType((const sal_Int32*)0), 0, SFX_METRIC_ITEM}, #define LINE_PROPERTIES_DEFAULTS\ + { MAP_CHAR_LEN(UNO_NAME_LINECAP), XATTR_LINECAP, &::getCppuType((const ::com::sun::star::drawing::LineCap*)0), 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_LINECOLOR), XATTR_LINECOLOR, &::getCppuType((const sal_Int32*)0) , 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_LINEENDCENTER), XATTR_LINEENDCENTER, &::getBooleanCppuType() , 0, 0}, \ { MAP_CHAR_LEN(UNO_NAME_LINEENDWIDTH), XATTR_LINEENDWIDTH, &::getCppuType((const sal_Int32*)0) , 0, SFX_METRIC_ITEM}, \ @@ -423,11 +420,12 @@ #define SPECIAL_GRAPHOBJ_PROPERTIES \ SPECIAL_GRAPHOBJ_PROPERTIES_DEFAULTS \ - { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_GRAPHICCROP), SDRATTR_GRAFCROP , &::getCppuType((const ::com::sun::star::text::GraphicCrop*)0), 0, 0 }, \ - { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAFURL), OWN_ATTR_GRAFURL , &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, \ - { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL),OWN_ATTR_GRAFSTREAMURL , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, \ - { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_FILLBITMAP), OWN_ATTR_VALUE_FILLBITMAP , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>*)0) , 0, 0}, \ - { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAPHIC), OWN_ATTR_VALUE_GRAPHIC , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic>*)0) , 0, 0}, + { MAP_CHAR_LEN(UNO_NAME_GRAPHIC_GRAPHICCROP), SDRATTR_GRAFCROP , &::getCppuType((const ::com::sun::star::text::GraphicCrop*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAFURL), OWN_ATTR_GRAFURL , &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_REPLACEMENTGRAFURL), OWN_ATTR_REPLACEMENTGRAFURL , &::getCppuType((const ::rtl::OUString*)0), 0, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAFSTREAMURL), OWN_ATTR_GRAFSTREAMURL , &::getCppuType((const ::rtl::OUString*)0), ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 }, \ + { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_FILLBITMAP), OWN_ATTR_VALUE_FILLBITMAP , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XBitmap>*)0) , 0, 0}, \ + { MAP_CHAR_LEN(UNO_NAME_GRAPHOBJ_GRAPHIC), OWN_ATTR_VALUE_GRAPHIC , &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic>*)0) , 0, 0}, #define SPECIAL_3DSCENEOBJECT_PROPERTIES_DEFAULTS \ diff --git a/svx/inc/svx/xattr.hxx b/svx/inc/svx/xattr.hxx index dad046eb93fb..d3d1a1b6e057 100644 --- a/svx/inc/svx/xattr.hxx +++ b/svx/inc/svx/xattr.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ +/* + * 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 . + */ #ifndef _XATTR_HXX #define _XATTR_HXX @@ -40,6 +31,7 @@ #include <svx/xtextit0.hxx> #include <svx/xsetit.hxx> #include <svx/xlinjoit.hxx> +#include <svx/xlncapit.hxx> #endif // _XATTR_HXX diff --git a/svx/inc/svx/xdef.hxx b/svx/inc/svx/xdef.hxx index beaaa8a38179..a148f1ecdc78 100644 --- a/svx/inc/svx/xdef.hxx +++ b/svx/inc/svx/xdef.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. +/* + * This file is part of the LibreOffice project. * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). + * 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/. * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. + * 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 . + */ #ifndef _XDEF_HXX #define _XDEF_HXX @@ -55,7 +46,8 @@ #define XATTR_LINEENDCENTER (XATTR_LINE_FIRST + 9) /* V3: 1009 V2: 1009 */ #define XATTR_LINETRANSPARENCE (XATTR_LINE_FIRST + 10) /* V3: 1010 V2: 1010 */ #define XATTR_LINEJOINT (XATTR_LINE_FIRST + 11) /* V3: 1011 V2: 1011 */ -#define XATTR_LINE_LAST XATTR_LINEJOINT +#define XATTR_LINECAP (XATTR_LINE_FIRST + 12) /* V3: 1012 */ +#define XATTR_LINE_LAST XATTR_LINECAP #define XATTRSET_LINE (XATTR_LINE_LAST + 1) /* V3: 1017 V2: 1017 */ #define XATTR_FILL_FIRST (XATTRSET_LINE + 1) /* V3: 1018 V2: 1018 */ diff --git a/svx/inc/svx/xlncapit.hxx b/svx/inc/svx/xlncapit.hxx new file mode 100644 index 000000000000..b43b6c83a49f --- /dev/null +++ b/svx/inc/svx/xlncapit.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * 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 . + */ + +#ifndef _SVX_XLNCAPIT_HXX +#define _SVX_XLNCAPIT_HXX + +#include <svx/svxdllapi.h> +#include <svl/eitem.hxx> +#include <svx/xenum.hxx> +#include <com/sun/star/drawing/LineCap.hpp> + +//--------------------- +// class LineStyleItem +//--------------------- + +class SVX_DLLPUBLIC XLineCapItem : public SfxEnumItem +{ +public: + TYPEINFO(); + XLineCapItem(com::sun::star::drawing::LineCap eLineCap = com::sun::star::drawing::LineCap_BUTT); + XLineCapItem(SvStream& rIn); + + virtual sal_uInt16 GetVersion( sal_uInt16 nFileFormatVersion ) const; + virtual SfxPoolItem* Clone( SfxItemPool* pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rIn, sal_uInt16 nVer ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, + String &rText, const IntlWrapper * = 0 ) const; + + virtual sal_uInt16 GetValueCount() const; + com::sun::star::drawing::LineCap GetValue() const; +}; + +#endif // _SVX_XLNCAPIT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 3213c01d230e..34e9a951dffd 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <vcl/wrkwin.hxx> #include <tools/shl.hxx> @@ -1002,9 +993,6 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) default: { - OSL_ENSURE( pAction->GetType() != META_RENDERGRAPHIC_ACTION, - "META_RENDERGRAPHIC_ACTION currently not supported at masking" ); - pAction->Duplicate(); aMtf.AddAction( pAction ); } diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index 9fa5b8a48c67..9feff429c046 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <svx/sdr/attribute/sdrformtextattribute.hxx> #include <basegfx/vector/b2enums.hxx> @@ -46,12 +36,15 @@ #include <svx/xlnclit.hxx> #include <svx/xlnwtit.hxx> #include <svx/xlinjoit.hxx> +#include <svx/xlinjoit.hxx> +#include <svx/xlncapit.hxx> #include <svx/xlineit0.hxx> #include <svx/xdash.hxx> #include <svx/xlndsit.hxx> #include <drawinglayer/attribute/lineattribute.hxx> #include <drawinglayer/attribute/strokeattribute.hxx> #include <svx/sdr/attribute/sdrformtextoutlineattribute.hxx> +#include <com/sun/star/drawing/LineCap.hpp> ////////////////////////////////////////////////////////////////////////////// // helper to get line, stroke and transparence attributes from SfxItemSet @@ -119,7 +112,13 @@ namespace const sal_uInt32 nLineWidth = ((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue(); const XLineJoint eLineJoint = ((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue(); - return drawinglayer::attribute::LineAttribute(aColorAttribute, (double)nLineWidth, impGetB2DLineJoin(eLineJoint)); + const com::sun::star::drawing::LineCap eLineCap = ((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue(); + + return drawinglayer::attribute::LineAttribute( + aColorAttribute, + (double)nLineWidth, + impGetB2DLineJoin(eLineJoint), + eLineCap); } drawinglayer::attribute::StrokeAttribute impGetStrokeAttribute(const SfxItemSet& rSet) diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index ef8c1ccaf1fa..144f9919810a 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <svx/sdr/contact/viewcontactofgraphic.hxx> #include <svx/sdr/contact/viewobjectcontactofgraphic.hxx> @@ -413,11 +404,12 @@ namespace sdr { // create primitive. Info: Calling the copy-constructor of GraphicObject in this // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::SdrGrafPrimitive2D( - aObjectMatrix, - aAttribute, - rGraphicObject, - aLocalGrafInfo)); + const drawinglayer::primitive2d::Primitive2DReference xReference( + new drawinglayer::primitive2d::SdrGrafPrimitive2D( + aObjectMatrix, + aAttribute, + rGraphicObject, + aLocalGrafInfo)); xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); } diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx index 6b0cdb6de04d..4dd6e207a07e 100644 --- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <svx/sdr/contact/viewcontactofsdrole2obj.hxx> #include <svx/svdoole2.hxx> @@ -41,6 +31,8 @@ #include <vcl/svapp.hxx> #include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/primitive2d/transformprimitive2d.hxx> +#include <svx/charthelper.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -67,7 +59,7 @@ namespace sdr { } - drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters() const + basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const { // take unrotated snap rect (direct model data) for position and size const Rectangle& rRectangle = GetOle2Obj().GetGeoRect(); @@ -77,9 +69,18 @@ namespace sdr const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat()); const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0); const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0); - const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( - aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate, - aObjectRange.getMinX(), aObjectRange.getMinY())); + + return basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix( + aObjectRange.getWidth(), aObjectRange.getHeight(), + fShearX, + fRotate, + aObjectRange.getMinX(), aObjectRange.getMinY()); + } + + drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters() const + { + // get object transformation + const basegfx::B2DHomMatrix aObjectMatrix(createObjectTransform()); // Prepare attribute settings, will be used soon anyways const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet(); @@ -87,28 +88,58 @@ namespace sdr drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute( rItemSet, GetOle2Obj().getText(0))); - - // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing - // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect - // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). - // It will also take care of HighContrast and ScaleContent - const drawinglayer::primitive2d::Primitive2DReference xOleContent( - new drawinglayer::primitive2d::SdrOleContentPrimitive2D( + drawinglayer::primitive2d::Primitive2DReference xContent; + + if(GetOle2Obj().IsChart()) + { + // try to get chart primitives and chart range directly from xChartModel + basegfx::B2DRange aChartContentRange; + const drawinglayer::primitive2d::Primitive2DSequence aChartSequence( + ChartHelper::tryToGetChartContentAsPrimitive2DSequence( + GetOle2Obj().getXModel(), + aChartContentRange)); + const double fWidth(aChartContentRange.getWidth()); + const double fHeight(aChartContentRange.getHeight()); + + if(aChartSequence.hasElements() + && basegfx::fTools::more(fWidth, 0.0) + && basegfx::fTools::more(fHeight, 0.0)) + { + // create embedding transformation + basegfx::B2DHomMatrix aEmbed( + basegfx::tools::createTranslateB2DHomMatrix( + -aChartContentRange.getMinX(), + -aChartContentRange.getMinY())); + + aEmbed.scale(1.0 / fWidth, 1.0 / fHeight); + aEmbed = aObjectMatrix * aEmbed; + xContent = new drawinglayer::primitive2d::TransformPrimitive2D( + aEmbed, + aChartSequence); + } + } + + if(!xContent.is()) + { + // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing + // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect + // calculations without OLE Graphic access (which may trigger e.g. chart recalculation). + // It will also take care of HighContrast and ScaleContent + xContent = new drawinglayer::primitive2d::SdrOleContentPrimitive2D( GetOle2Obj(), aObjectMatrix, // #i104867# add GraphicVersion number to be able to check for // content change in the primitive later - GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion() - )); + GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion() ); + } // create primitive. Use Ole2 primitive here. Prepare attribute settings, will // be used soon anyways. Always create primitives to allow the decomposition of // SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect - const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1); const drawinglayer::primitive2d::Primitive2DReference xReference( new drawinglayer::primitive2d::SdrOle2Primitive2D( - xOLEContent, + drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1), aObjectMatrix, aAttribute)); diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx index 674c79a3aa68..cb4edcb0f98a 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <svx/sdr/contact/viewobjectcontactofsdrole2obj.hxx> #include <svx/sdr/contact/viewobjectcontactofsdrobj.hxx> @@ -33,12 +23,12 @@ #include <svx/svdoole2.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include <svx/svdview.hxx> -#include <drawinglayer/primitive2d/chartprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/EmbedStates.hpp> #include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -73,7 +63,6 @@ namespace sdr const bool bIsOutplaceActive(nState == embed::EmbedStates::ACTIVE); const bool bIsInplaceActive((nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE)); - const bool bIsChart(rSdrOle2.IsChart()); bool bDone(false); if(!bDone && bIsInplaceActive) @@ -88,122 +77,49 @@ namespace sdr if( !bDone ) { - const Rectangle& rObjectRectangle(rSdrOle2.GetGeoRect()); - const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom()); - - // create object transform - basegfx::B2DHomMatrix aObjectTransform; - aObjectTransform.set(0, 0, aObjectRange.getWidth()); - aObjectTransform.set(1, 1, aObjectRange.getHeight()); - aObjectTransform.set(0, 2, aObjectRange.getMinX()); - aObjectTransform.set(1, 2, aObjectRange.getMinY()); - - if(bIsChart) + //old stuff that should be reworked { - //charts must be painted resolution dependent!! #i82893#, #i75867# - - // for chart, to not lose the current better quality visualisation which - // uses a direct paint, use a primtive wrapper for that exceptional case. The renderers - // will then ATM paint it to an OutputDevice directly. - // In later versions this should be replaced by getting the Primitive2DSequnce from - // the chart and using it. - // to be able to render something in non-VCL using renderers, the wrapper is a - // GroupPrimitive2D which automatically decomposes to the already created Metafile - // content. - // For being completely compatible, ATM Window and VDEV PrettyPrinting is suppressed. - // It works in the VCL renderers, though. So for activating again with VCL primitive - // renderers, change conditions here. - - // determine if embedding and PrettyPrinting shall be done at all - uno::Reference< frame::XModel > xChartModel; - bool bDoChartPrettyPrinting(true); - - // the original ChartPrettyPainter does not do it for Window - if(bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow()) + //if no replacement image is available load the OLE object +// if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925# +// { +// // try to create embedded object +// rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already +// } + const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); + if(xObjRef.is()) { - bDoChartPrettyPrinting = false; - } + const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect())); - // the original ChartPrettyPainter does not do it for VDEV - if(bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice()) - { - if(GetObjectContact().isOutputToPDFFile()) + // this hack (to change model data during PAINT argh(!)) should be reworked + if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE)) { - // #i97982# - // For PDF files, allow PrettyPrinting + const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true); } - else - { - bDoChartPrettyPrinting = false; - } - } - - // the chart model is needed. Check if it's available - if(bDoChartPrettyPrinting) - { - // get chart model - xChartModel = rSdrOle2.getXModel(); - if(!xChartModel.is()) + SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); + if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE)) { - bDoChartPrettyPrinting = false; + // connect plugin object + pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2)); } } + }//end old stuff to rework - if(bDoChartPrettyPrinting) - { - // embed MetaFile data in a specialized Wrapper Primitive which holds also the ChartModel needed - // for PrettyPrinting - const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ChartPrimitive2D( - xChartModel, aObjectTransform, xRetval)); - xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1); - bDone = true; - } - } - - if( !bDone ) - { - //old stuff that should be reworked - { - //if no replacement image is available load the OLE object - if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925# - { - // try to create embedded object - rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already - } - const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef(); - if(xObjRef.is()) - { - const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect())); - - // this hack (to change model data during PAINT argh(!)) should be reworked - if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE)) - { - const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true); - } - - SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView(); - if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE)) - { - // connect plugin object - pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2)); - } - } - }//end old stuff to rework - - // create OLE primitive stuff directly at VC with HC as parameter - const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact()); - xRetval = rVC.createPrimitive2DSequenceWithParameters(); - } + // create OLE primitive stuff directly at VC with HC as parameter + const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact()); + xRetval = rVC.createPrimitive2DSequenceWithParameters(); if(bIsOutplaceActive) { // do not shade when printing or PDF exporting if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile()) { + // get object transformation + const basegfx::B2DHomMatrix aObjectMatrix(static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).createObjectTransform()); + // shade the representation if the object is activated outplace basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon()); - aObjectOutline.transform(aObjectTransform); + aObjectOutline.transform(aObjectMatrix); // Use a FillHatchPrimitive2D with necessary attributes const drawinglayer::attribute::FillHatchAttribute aFillHatch( diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 0c079b77c08f..3fd7b44fc8ca 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <svx/sdr/primitive2d/sdrattributecreator.hxx> #include <svl/itemset.hxx> @@ -35,6 +26,7 @@ #include <svx/xlntrit.hxx> #include <svx/xlnwtit.hxx> #include <svx/xlinjoit.hxx> +#include <svx/xlncapit.hxx> #include <svx/xlnclit.hxx> #include <svx/xlnstwit.hxx> #include <svx/xlnedwit.hxx> @@ -82,6 +74,7 @@ #include <drawinglayer/attribute/sdrlightingattribute3d.hxx> #include <drawinglayer/attribute/sdrlightattribute3d.hxx> #include <svx/sdr/attribute/sdrfilltextattribute.hxx> +#include <com/sun/star/drawing/LineCap.hpp> ////////////////////////////////////////////////////////////////////////////// @@ -241,6 +234,7 @@ namespace drawinglayer const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue()); const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue()); const XLineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue()); + const com::sun::star::drawing::LineCap eCap(((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue()); ::std::vector< double > aDotDashArray; double fFullDotDashLen(0.0); @@ -259,6 +253,7 @@ namespace drawinglayer (double)nWidth, (double)nTransparence * 0.01, aColor.getBColor(), + eCap, aDotDashArray, fFullDotDashLen); } @@ -596,7 +591,11 @@ namespace drawinglayer // make sure it's not empty, use default instead if(aBitmap.IsEmpty()) { + // #i118485# Add PrefMapMode and PrefSize to avoid mini-tiling and + // expensive primitive processing in this case. Use 10x10 cm aBitmap = Bitmap(Size(4,4), 8); + aBitmap.SetPrefMapMode(MapMode(MAP_100TH_MM)); + aBitmap.SetPrefSize(Size(10000.0, 10000.0)); } // if there is no logical size, create a size from pixel size and set MapMode accordingly diff --git a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx index 81b792f68660..fe8320163241 100644 --- a/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx +++ b/svx/source/sdr/primitive2d/sdrdecompositiontools.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> @@ -133,7 +124,7 @@ namespace drawinglayer aScaledPolygon.transform(rObjectTransform); // create line and stroke attribute - const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin()); + const attribute::LineAttribute aLineAttribute(rLine.getColor(), rLine.getWidth(), rLine.getJoin(), rLine.getCap()); const attribute::StrokeAttribute aStrokeAttribute(rLine.getDotDashArray(), rLine.getFullDotDashLen()); BasePrimitive2D* pNewLinePrimitive = 0L; diff --git a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx index 93b09553c3e9..aeccd8611bec 100644 --- a/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrgrafprimitive2d.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <svx/sdr/primitive2d/sdrgrafprimitive2d.hxx> #include <drawinglayer/primitive2d/graphicprimitive2d.hxx> @@ -34,8 +25,8 @@ #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx> #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx> #include <basegfx/polygon/b2dpolygon.hxx> - -////////////////////////////////////////////////////////////////////////////// +#include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/primitive2d/transformprimitive2d.hxx> namespace drawinglayer { @@ -98,6 +89,7 @@ namespace drawinglayer // add graphic content if(255L != getGraphicAttr().GetTransparency()) { + // standard graphic fill const Primitive2DReference xGraphicContentPrimitive( new GraphicPrimitive2D( getTransform(), @@ -164,7 +156,8 @@ namespace drawinglayer bool SdrGrafPrimitive2D::isTransparent() const { - return ((0L != getGraphicAttr().GetTransparency()) || (getGraphicObject().IsTransparent())); + return ((0L != getGraphicAttr().GetTransparency()) + || (getGraphicObject().IsTransparent())); } // provide unique ID diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx new file mode 100644 index 000000000000..c4cb613279ed --- /dev/null +++ b/svx/source/svdraw/charthelper.cxx @@ -0,0 +1,137 @@ +/* + * 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 . + */ + +#include <svx/charthelper.hxx> +#include <svtools/embedhlp.hxx> +#include <tools/globname.hxx> +#include <sot/clsids.hxx> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/processfactory.hxx> +#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> +#include <drawinglayer/geometry/viewinformation2d.hxx> + +//// header for function rtl_createUuid +//#include <rtl/uuid.h> +//#include <vcl/pdfextoutdevdata.hxx> +// +//#include <com/sun/star/lang/XUnoTunnel.hpp> +//#include <com/sun/star/lang/XMultiServiceFactory.hpp> +//#include <svtools/embedhlp.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace ::com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +bool ChartHelper::IsChart(const svt::EmbeddedObjectRef& xObjRef) +{ + if(!xObjRef.is()) + { + return false; + } + + const SvGlobalName aObjClsId(xObjRef->getClassID()); + + if(SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId + || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId + || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId + || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId) + { + return true; + } + + return false; +} + +drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContentAsPrimitive2DSequence( + const uno::Reference< ::frame::XModel >& rXModel, + basegfx::B2DRange& rRange) +{ + drawinglayer::primitive2d::Primitive2DSequence aRetval; + + if(rXModel.is()) + { + try + { + const uno::Reference< lang::XMultiServiceFactory > xChartFact(rXModel, uno::UNO_QUERY_THROW); + const uno::Reference< lang::XUnoTunnel > xChartView(xChartFact->createInstance(::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartView")), uno::UNO_QUERY_THROW); + const uno::Reference< util::XUpdatable > xUpdatable(xChartView, uno::UNO_QUERY_THROW); + + if(xUpdatable.is()) + { + xUpdatable->update(); + + const uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier(rXModel, uno::UNO_QUERY_THROW); + const uno::Reference< container::XIndexAccess > xShapeAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW); + + if(xShapeAccess.is() && xShapeAccess->getCount()) + { + const sal_Int32 nShapeCount(xShapeAccess->getCount()); + const uno::Reference< lang::XMultiServiceFactory > xMgr(::comphelper::getProcessServiceFactory()); + const uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory( + xMgr->createInstance( + String(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D" ))), + uno::UNO_QUERY); + + if(xPrimitiveFactory.is()) + { + const uno::Sequence< beans::PropertyValue > aParams; + uno::Reference< drawing::XShape > xShape; + + for(sal_Int32 a(0); a < nShapeCount; a++) + { + xShapeAccess->getByIndex(a) >>= xShape; + + if(xShape.is()) + { + const drawinglayer::primitive2d::Primitive2DSequence aNew( + xPrimitiveFactory->createPrimitivesFromXShape( + xShape, + aParams)); + + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( + aRetval, + aNew); + } + } + } + } + } + } + catch(uno::Exception&) + { + OSL_ENSURE(false, "Unexpected exception!"); + } + + if(aRetval.hasElements()) + { + const drawinglayer::geometry::ViewInformation2D aViewInformation2D; + + rRange = drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(aRetval, aViewInformation2D); + } + } + + return aRetval; +} + +////////////////////////////////////////////////////////////////////////////// +// eof diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 8c7762ffcf24..c16bbdba6721 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include "svddrgm1.hxx" #include <math.h> @@ -3610,6 +3600,19 @@ bool SdrDragCrop::EndSdrDrag(bool bCopy) double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / (double)aOldRect.GetWidth(); double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / (double)aOldRect.GetHeight(); + // to correct the never working combination of cropped images and mirroring + // I have to correct the rectangles the calculation is based on here. In the current + // core geometry stuff a vertical mirror is expressed as 180 degree rotation. All + // this can be removed again when aw080 will have cleaned up the old + // (non-)transformation mess in the core. + if(18000 == pObj->GetGeoStat().nDrehWink) + { + // old notation of vertical mirror, need to correct diffs since both rects + // are rotated by 180 degrees + aOldRect = Rectangle(aOldRect.TopLeft() - (aOldRect.BottomRight() - aOldRect.TopLeft()), aOldRect.TopLeft()); + aNewRect = Rectangle(aNewRect.TopLeft() - (aNewRect.BottomRight() - aNewRect.TopLeft()), aNewRect.TopLeft()); + } + sal_Int32 nDiffLeft = aNewRect.nLeft - aOldRect.nLeft; sal_Int32 nDiffTop = aNewRect.nTop - aOldRect.nTop; sal_Int32 nDiffRight = aNewRect.nRight - aOldRect.nRight; diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index dfdf7efedddc..4914b98fb689 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <vcl/metaact.hxx> #include <svx/svdedtv.hxx> @@ -47,12 +37,6 @@ // #i13033# #include <clonelist.hxx> -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// -// EditView -//////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////// - void SdrEditView::ImpResetPossibilityFlags() { bReadOnly =sal_False; @@ -618,19 +602,20 @@ void SdrEditView::CheckPossibilities() if (!bOrthoDesiredOnMarked && !aInfo.bNoOrthoDesired) bOrthoDesiredOnMarked=sal_True; // check ImportMtf - if (!bImportMtfPossible) { - sal_Bool bGraf=HAS_BASE(SdrGrafObj,pObj); - sal_Bool bOle2=HAS_BASE(SdrOle2Obj,pObj); + if (!bImportMtfPossible) + { + const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(pObj); + const SdrOle2Obj* pSdrOle2Obj = dynamic_cast< const SdrOle2Obj* >(pObj); - if( bGraf && - ((SdrGrafObj*)pObj)->HasGDIMetaFile() && - !( ((SdrGrafObj*)pObj)->IsEPS() || ((SdrGrafObj*)pObj)->IsRenderGraphic() ) ) + if(pSdrGrafObj && ((pSdrGrafObj->HasGDIMetaFile() && !pSdrGrafObj->IsEPS()) || pSdrGrafObj->isEmbeddedSvg())) { bImportMtfPossible = sal_True; } - if (bOle2) - bImportMtfPossible=((SdrOle2Obj*)pObj)->GetObjRef().is(); + if(pSdrOle2Obj) + { + bImportMtfPossible = pSdrOle2Obj->GetObjRef().is(); + } } } diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 4fd186a518e5..d97a83275d71 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <svx/svdedtv.hxx> #include <editeng/outliner.hxx> @@ -2016,30 +2006,78 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) SdrGrafObj* pGraf=PTR_CAST(SdrGrafObj,pObj); SdrOle2Obj* pOle2=PTR_CAST(SdrOle2Obj,pObj); sal_uIntPtr nInsAnz=0; - if (pGraf!=NULL && pGraf->HasGDIMetaFile()) + Rectangle aLogicRect; + + if(pGraf && (pGraf->HasGDIMetaFile() || pGraf->isEmbeddedSvg())) { - ImpSdrGDIMetaFileImport aFilter(*pMod); - aFilter.SetScaleRect(pGraf->GetSnapRect()); - aFilter.SetLayer(pObj->GetLayer()); - nInsAnz=aFilter.DoImport(pGraf->GetTransformedGraphic().GetGDIMetaFile(),*pOL,nInsPos,pProgrInfo); + GDIMetaFile aMetaFile; + + if(pGraf->HasGDIMetaFile()) + { + aMetaFile = pGraf->GetTransformedGraphic( + SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile(); + } + else if(pGraf->isEmbeddedSvg()) + { + aMetaFile = pGraf->getMetafileFromEmbeddedSvg(); + } + + if(aMetaFile.GetActionSize()) + { + ImpSdrGDIMetaFileImport aFilter(*pMod); + + aLogicRect = pGraf->GetLogicRect(); + aFilter.SetScaleRect(aLogicRect); + aFilter.SetLayer(pObj->GetLayer()); + + nInsAnz = aFilter.DoImport(aMetaFile, *pOL, nInsPos, pProgrInfo); + } } if ( pOle2!=NULL && pOle2->GetGraphic() ) { ImpSdrGDIMetaFileImport aFilter(*pMod); - aFilter.SetScaleRect(pOle2->GetLogicRect()); + + aLogicRect = pOle2->GetLogicRect(); + aFilter.SetScaleRect(aLogicRect); aFilter.SetLayer(pObj->GetLayer()); nInsAnz=aFilter.DoImport(pOle2->GetGraphic()->GetGDIMetaFile(),*pOL,nInsPos,pProgrInfo); } if (nInsAnz!=0) { + // transformation + GeoStat aGeoStat(pGraf ? pGraf->GetGeoStat() : pOle2->GetGeoStat()); sal_uIntPtr nObj=nInsPos; + + if(aGeoStat.nShearWink) + { + aGeoStat.RecalcTan(); + } + + if(aGeoStat.nDrehWink) + { + aGeoStat.RecalcSinCos(); + } + for (sal_uIntPtr i=0; i<nInsAnz; i++) { if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pOL->GetObj(nObj))); // update new MarkList - SdrMark aNewMark(pOL->GetObj(nObj), pPV); + SdrObject* pCandidate = pOL->GetObj(nObj); + + // apply original transformation + if(aGeoStat.nShearWink) + { + pCandidate->NbcShear(aLogicRect.TopLeft(), aGeoStat.nShearWink, aGeoStat.nTan, false); + } + + if(aGeoStat.nDrehWink) + { + pCandidate->NbcRotate(aLogicRect.TopLeft(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos); + } + + SdrMark aNewMark(pCandidate, pPV); aNewMarked.InsertEntry(aNewMark); nObj++; diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index b8c007ea97fb..1fd41d246214 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include "svdfmtf.hxx" #include <editeng/editdata.hxx> @@ -40,6 +30,7 @@ #include <editeng/crsditem.hxx> #include <editeng/shdditem.hxx> #include <svx/xlnclit.hxx> +#include <svx/xlncapit.hxx> #include <svx/xlnwtit.hxx> #include <svx/xflclit.hxx> #include <svx/xgrad.hxx> @@ -79,6 +70,7 @@ ImpSdrGDIMetaFileImport::ImpSdrGDIMetaFileImport(SdrModel& rModel): pPage(NULL),pModel(NULL),nLayer(0), nLineWidth(0), maLineJoin(basegfx::B2DLINEJOIN_NONE), + maLineCap(com::sun::star::drawing::LineCap_BUTT), maDash(XDASH_RECT, 0, 0, 0, 0, 0), fScaleX(0.0),fScaleY(0.0), bFntDirty(sal_True), @@ -195,7 +187,6 @@ sal_uIntPtr ImpSdrGDIMetaFileImport::DoImport(const GDIMetaFile& rMtf, case META_POP_ACTION : DoAction((MetaPopAction &)*pAct); break; case META_HATCH_ACTION : DoAction((MetaHatchAction &)*pAct); break; case META_COMMENT_ACTION : DoAction((MetaCommentAction &)*pAct, pMtf); break; - case META_RENDERGRAPHIC_ACTION : DoAction((MetaRenderGraphicAction &)*pAct); break; } if(pProgrInfo != NULL) @@ -309,6 +300,9 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr break; } + // Add LineCap support + pLineAttr->Put(XLineCapItem(maLineCap)); + if(((maDash.GetDots() && maDash.GetDotLen()) || (maDash.GetDashes() && maDash.GetDashLen())) && maDash.GetDistance()) { pLineAttr->Put(XLineDashItem(String(), maDash)); @@ -354,10 +348,13 @@ void ImpSdrGDIMetaFileImport::SetAttributes(SdrObject* pObj, bool bForceTextAttr pTextAttr->Put(SvxOverlineItem(aFnt.GetOverline(), EE_CHAR_OVERLINE)); pTextAttr->Put(SvxCrossedOutItem(aFnt.GetStrikeout(), EE_CHAR_STRIKEOUT)); pTextAttr->Put(SvxShadowedItem(aFnt.IsShadow(), EE_CHAR_SHADOW)); - pTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING)); + + // #i118485# Setting this item leads to problems (written #i118498# for this) + // pTextAttr->Put(SvxAutoKernItem(aFnt.IsKerning(), EE_CHAR_KERNING)); + pTextAttr->Put(SvxWordLineModeItem(aFnt.IsWordLineMode(), EE_CHAR_WLM)); pTextAttr->Put(SvxContourItem(aFnt.IsOutline(), EE_CHAR_OUTLINE)); - pTextAttr->Put(SvxColorItem(aFnt.GetColor(), EE_CHAR_COLOR)); + pTextAttr->Put(SvxColorItem(aVD.GetTextColor(), EE_CHAR_COLOR)); //... svxfont textitem svditext bFntDirty=sal_False; } @@ -480,6 +477,7 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaLineAction& rAct) SdrPathObj* pPath = new SdrPathObj(OBJ_LINE, basegfx::B2DPolyPolygon(aLine)); nLineWidth = nNewLineWidth; maLineJoin = rLineInfo.GetLineJoin(); + maLineCap = rLineInfo.GetLineCap(); maDash = XDash(XDASH_RECT, rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), @@ -685,6 +683,7 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaPolyLineAction& rAct ) basegfx::B2DPolyPolygon(aSource)); nLineWidth = nNewLineWidth; maLineJoin = rLineInfo.GetLineJoin(); + maLineCap = rLineInfo.GetLineCap(); maDash = XDash(XDASH_RECT, rLineInfo.GetDotCount(), rLineInfo.GetDotLen(), rLineInfo.GetDashCount(), rLineInfo.GetDashLen(), @@ -1021,25 +1020,4 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM } } -//////////////////////////////////////////////////////////////////////////////////////////////////// - -void ImpSdrGDIMetaFileImport::DoAction(MetaRenderGraphicAction& rAct) -{ - GDIMetaFile aMtf; - const ::vcl::RenderGraphic& rRenderGraphic = rAct.GetRenderGraphic(); - Rectangle aRect( rAct.GetPoint(), rAct.GetSize() ); - const Point aPos; - const Size aPrefSize( rRenderGraphic.GetPrefSize() ); - - aRect.Right()++; aRect.Bottom()++; - - aMtf.SetPrefMapMode( rRenderGraphic.GetPrefMapMode() ); - aMtf.SetPrefSize( aPrefSize ); - aMtf.AddAction( new MetaRenderGraphicAction( aPos, aPrefSize, rRenderGraphic ) ); - aMtf.WindStart(); - - SdrGrafObj* pGraf=new SdrGrafObj( aMtf, aRect ); - InsertObj( pGraf ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdfmtf.hxx b/svx/source/svdraw/svdfmtf.hxx index f0fc89ec4f09..5f31f583e45e 100644 --- a/svx/source/svdraw/svdfmtf.hxx +++ b/svx/source/svdraw/svdfmtf.hxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #ifndef _SVDFMTF_HXX #define _SVDFMTF_HXX @@ -65,6 +56,7 @@ protected: Color aOldLineColor; sal_Int32 nLineWidth; basegfx::B2DLineJoin maLineJoin; + com::sun::star::drawing::LineCap maLineCap; XDash maDash; sal_Bool bMov; @@ -121,7 +113,6 @@ protected: void DoAction(MetaISectRectClipRegionAction& rAct) { rAct.Execute(&aVD); } void DoAction(MetaISectRegionClipRegionAction& rAct) { rAct.Execute(&aVD); } void DoAction(MetaCommentAction& rAct, GDIMetaFile* pMtf); - void DoAction(MetaRenderGraphicAction& rAct); void ImportText( const Point& rPos, const XubString& rStr, const MetaAction& rAct ); void SetAttributes(SdrObject* pObj, bool bForceTextAttr = false); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 1bff49d54bc7..51b908955bbf 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <com/sun/star/lang/XComponent.hpp> @@ -1201,10 +1192,10 @@ basegfx::B2DPolyPolygon SdrObject::TakeContour() const // use neutral ViewInformation const drawinglayer::geometry::ViewInformation2D aViewInformation2D; - // create extractor, process and get result - drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D); + // create extractor, process and get result (with hairlines as opened polygons) + drawinglayer::processor2d::ContourExtractor2D aExtractor(aViewInformation2D, false); aExtractor.process(xSequence); - const std::vector< basegfx::B2DPolyPolygon >& rResult(aExtractor.getExtractedContour()); + const basegfx::B2DPolyPolygonVector& rResult(aExtractor.getExtractedContour()); const sal_uInt32 nSize(rResult.size()); // when count is one, it is implied that the object has only its normal @@ -2411,7 +2402,7 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDas aExtractor.process(xSequence); // #i102241# check for line results - const std::vector< basegfx::B2DPolygon >& rHairlineVector = aExtractor.getExtractedHairlines(); + const basegfx::B2DPolygonVector& rHairlineVector = aExtractor.getExtractedHairlines(); if(!rHairlineVector.empty()) { @@ -2423,7 +2414,7 @@ SdrObject* SdrObject::ImpConvertToContourObj(SdrObject* pRet, bool bForceLineDas } // #i102241# check for fill rsults - const std::vector< basegfx::B2DPolyPolygon >& rLineFillVector(aExtractor.getExtractedLineFills()); + const basegfx::B2DPolyPolygonVector& rLineFillVector(aExtractor.getExtractedLineFills()); if(!rLineFillVector.empty()) { @@ -2698,7 +2689,7 @@ SdrObject* SdrObject::ConvertToContourObj(SdrObject* pRet, bool bForceLineDash) SdrObject* SdrObject::ConvertToPolyObj(bool bBezier, bool bLineToArea) const { - SdrObject* pRet = DoConvertToPolyObj(bBezier); + SdrObject* pRet = DoConvertToPolyObj(bBezier /*, true */); // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE if(pRet && bLineToArea) { @@ -2718,7 +2709,8 @@ SdrObject* SdrObject::ConvertToPolyObj(bool bBezier, bool bLineToArea) const //////////////////////////////////////////////////////////////////////////////////////////////////// -SdrObject* SdrObject::DoConvertToPolyObj(sal_Bool /*bBezier*/) const +// FIXME_REMOVE_WHEN_RE_BASE_COMPLETE comment .. +SdrObject* SdrObject::DoConvertToPolyObj(sal_Bool /*bBezier*/ /*, bool */ /*bAddText*/) const { return NULL; } diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index bc9d0f7f2fa4..f3d0f22a7403 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <unotools/streamwrap.hxx> @@ -324,8 +315,11 @@ SdrGrafObj::SdrGrafObj() bMirrored ( false ) { pGraphic = new GraphicObject; + mpReplacementGraphic = 0; pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); - bNoShear = true; + + // #i118485# Shear allowed and possible now + bNoShear = false; mbGrafAnimationAllowed = true; @@ -346,8 +340,11 @@ SdrGrafObj::SdrGrafObj(const Graphic& rGrf, const Rectangle& rRect) bMirrored ( false ) { pGraphic = new GraphicObject( rGrf ); + mpReplacementGraphic = 0; pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); - bNoShear = true; + + // #i118485# Shear allowed and possible now + bNoShear = false; mbGrafAnimationAllowed = true; @@ -368,8 +365,11 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf ) bMirrored ( false ) { pGraphic = new GraphicObject( rGrf ); + mpReplacementGraphic = 0; pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); - bNoShear = true; + + // #i118485# Shear allowed and possible now + bNoShear = false; mbGrafAnimationAllowed = true; @@ -387,6 +387,7 @@ SdrGrafObj::SdrGrafObj( const Graphic& rGrf ) SdrGrafObj::~SdrGrafObj() { delete pGraphic; + delete mpReplacementGraphic; ImpLinkAbmeldung(); } @@ -395,6 +396,8 @@ SdrGrafObj::~SdrGrafObj() void SdrGrafObj::SetGraphicObject( const GraphicObject& rGrfObj ) { *pGraphic = rGrfObj; + delete mpReplacementGraphic; + mpReplacementGraphic = 0; pGraphic->SetSwapStreamHdl( LINK( this, SdrGrafObj, ImpSwapHdl ), SWAPGRAPHIC_TIMEOUT ); pGraphic->SetUserData(); mbIsPreview = false; @@ -414,11 +417,28 @@ const GraphicObject& SdrGrafObj::GetGraphicObject(bool bForceSwapIn) const return *pGraphic; } +const GraphicObject* SdrGrafObj::GetReplacementGraphicObject() const +{ + if(!mpReplacementGraphic && pGraphic) + { + const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); + + if(rSvgDataPtr.get()) + { + const_cast< SdrGrafObj* >(this)->mpReplacementGraphic = new GraphicObject(rSvgDataPtr->getReplacement()); + } + } + + return mpReplacementGraphic; +} + // ----------------------------------------------------------------------------- void SdrGrafObj::NbcSetGraphic( const Graphic& rGrf ) { pGraphic->SetGraphic( rGrf ); + delete mpReplacementGraphic; + mpReplacementGraphic = 0; pGraphic->SetUserData(); mbIsPreview = false; } @@ -497,16 +517,6 @@ bool SdrGrafObj::IsEPS() const return pGraphic->IsEPS(); } -bool SdrGrafObj::IsRenderGraphic() const -{ - return pGraphic->IsRenderGraphic(); -} - -bool SdrGrafObj::HasRenderGraphic() const -{ - return pGraphic->HasRenderGraphic(); -} - bool SdrGrafObj::IsSwappedOut() const { return mbIsPreview ? true : pGraphic->IsSwappedOut(); @@ -661,7 +671,6 @@ const rtl::OUString& SdrGrafObj::GetFilterName() const void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const { bool bAnim = pGraphic->IsAnimated(); - bool bRenderGraphic = pGraphic->HasRenderGraphic(); bool bNoPresGrf = ( pGraphic->GetType() != GRAPHIC_NONE ) && !bEmptyPresObj; rInfo.bResizeFreeAllowed = aGeo.nDrehWink % 9000 == 0 || @@ -669,19 +678,22 @@ void SdrGrafObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const aGeo.nDrehWink % 27000 == 0; rInfo.bResizePropAllowed = true; - rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic; - rInfo.bRotate90Allowed = bNoPresGrf && !bAnim && !bRenderGraphic; - rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim && !bRenderGraphic; - rInfo.bMirror45Allowed = bNoPresGrf && !bAnim && !bRenderGraphic; - rInfo.bMirror90Allowed = !bEmptyPresObj && !bRenderGraphic; + rInfo.bRotateFreeAllowed = bNoPresGrf && !bAnim; + rInfo.bRotate90Allowed = bNoPresGrf && !bAnim; + rInfo.bMirrorFreeAllowed = bNoPresGrf && !bAnim; + rInfo.bMirror45Allowed = bNoPresGrf && !bAnim; + rInfo.bMirror90Allowed = !bEmptyPresObj; rInfo.bTransparenceAllowed = false; rInfo.bGradientAllowed = false; - rInfo.bShearAllowed = false; + + // #i118485# Shear allowed and possible now + rInfo.bShearAllowed = true; + rInfo.bEdgeRadiusAllowed=false; - rInfo.bCanConvToPath = false; + rInfo.bCanConvToPath = !IsEPS(); rInfo.bCanConvToPathLineToArea = false; rInfo.bCanConvToPolyLineToArea = false; - rInfo.bCanConvToPoly = !IsEPS() && !bRenderGraphic; + rInfo.bCanConvToPoly = !IsEPS(); rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary()); } @@ -726,38 +738,50 @@ void SdrGrafObj::ImpSetLinkedGraphic( const Graphic& rGraphic ) void SdrGrafObj::TakeObjNameSingul(XubString& rName) const { - switch( pGraphic->GetType() ) + if(pGraphic) { - case GRAPHIC_BITMAP: - { - const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? - ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) : - ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) ); + const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); - rName=ImpGetResStr( nId ); + if(rSvgDataPtr.get()) + { + rName = ImpGetResStr(STR_ObjNameSingulGRAFSVG); } - break; + else + { + switch( pGraphic->GetType() ) + { + case GRAPHIC_BITMAP: + { + const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? + ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPTRANSLNK : STR_ObjNameSingulGRAFBMPTRANS ) : + ( IsLinkedGraphic() ? STR_ObjNameSingulGRAFBMPLNK : STR_ObjNameSingulGRAFBMP ) ); - case GRAPHIC_GDIMETAFILE: - rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFMTFLNK : STR_ObjNameSingulGRAFMTF ); - break; + rName=ImpGetResStr( nId ); + } + break; - case GRAPHIC_NONE: - rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFNONELNK : STR_ObjNameSingulGRAFNONE ); - break; + case GRAPHIC_GDIMETAFILE: + rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFMTFLNK : STR_ObjNameSingulGRAFMTF ); + break; - default: - rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFLNK : STR_ObjNameSingulGRAF ); - break; - } + case GRAPHIC_NONE: + rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFNONELNK : STR_ObjNameSingulGRAFNONE ); + break; - const String aName(GetName()); + default: + rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNameSingulGRAFLNK : STR_ObjNameSingulGRAF ); + break; + } + } - if( aName.Len() ) - { - rName.AppendAscii( " '" ); - rName += aName; - rName += sal_Unicode( '\'' ); + const String aName(GetName()); + + if( aName.Len() ) + { + rName.AppendAscii( " '" ); + rName += aName; + rName += sal_Unicode( '\'' ); + } } } @@ -765,38 +789,50 @@ void SdrGrafObj::TakeObjNameSingul(XubString& rName) const void SdrGrafObj::TakeObjNamePlural( XubString& rName ) const { - switch( pGraphic->GetType() ) + if(pGraphic) { - case GRAPHIC_BITMAP: - { - const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? - ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) : - ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) ); + const SvgDataPtr& rSvgDataPtr = pGraphic->GetGraphic().getSvgData(); - rName=ImpGetResStr( nId ); + if(rSvgDataPtr.get()) + { + rName = ImpGetResStr(STR_ObjNamePluralGRAFSVG); } - break; + else + { + switch( pGraphic->GetType() ) + { + case GRAPHIC_BITMAP: + { + const sal_uInt16 nId = ( ( pGraphic->IsTransparent() || ( (const SdrGrafTransparenceItem&) GetObjectItem( SDRATTR_GRAFTRANSPARENCE ) ).GetValue() ) ? + ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPTRANSLNK : STR_ObjNamePluralGRAFBMPTRANS ) : + ( IsLinkedGraphic() ? STR_ObjNamePluralGRAFBMPLNK : STR_ObjNamePluralGRAFBMP ) ); - case GRAPHIC_GDIMETAFILE: - rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFMTFLNK : STR_ObjNamePluralGRAFMTF ); - break; + rName=ImpGetResStr( nId ); + } + break; - case GRAPHIC_NONE: - rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFNONELNK : STR_ObjNamePluralGRAFNONE ); - break; + case GRAPHIC_GDIMETAFILE: + rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFMTFLNK : STR_ObjNamePluralGRAFMTF ); + break; - default: - rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFLNK : STR_ObjNamePluralGRAF ); - break; - } + case GRAPHIC_NONE: + rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFNONELNK : STR_ObjNamePluralGRAFNONE ); + break; - const String aName(GetName()); + default: + rName=ImpGetResStr( IsLinkedGraphic() ? STR_ObjNamePluralGRAFLNK : STR_ObjNamePluralGRAF ); + break; + } + } - if( aName.Len() ) - { - rName.AppendAscii( " '" ); - rName += aName; - rName += sal_Unicode( '\'' ); + const String aName(GetName()); + + if( aName.Len() ) + { + rName.AppendAscii( " '" ); + rName += aName; + rName += sal_Unicode( '\'' ); + } } } @@ -919,7 +955,8 @@ void SdrGrafObj::NbcMirror(const Point& rRef1, const Point& rRef2) void SdrGrafObj::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear) { - SdrRectObj::NbcRotate( rRef, nWink, tn, bVShear ); + // #i118485# Call Shear now, old version redirected to rotate + SdrRectObj::NbcShear(rRef, nWink, tn, bVShear); } // ----------------------------------------------------------------------------- @@ -1025,34 +1062,104 @@ bool SdrGrafObj::HasGDIMetaFile() const // ----------------------------------------------------------------------------- -SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier) const +bool SdrGrafObj::isEmbeddedSvg() const +{ + return GRAPHIC_BITMAP == GetGraphicType() && GetGraphic().getSvgData().get(); +} + +GDIMetaFile SdrGrafObj::getMetafileFromEmbeddedSvg() const +{ + GDIMetaFile aRetval; + + if(isEmbeddedSvg() && GetModel()) + { + VirtualDevice aOut; + const Rectangle aBoundRect(GetCurrentBoundRect()); + const MapMode aMap(GetModel()->GetScaleUnit(), Point(), GetModel()->GetScaleFraction(), GetModel()->GetScaleFraction()); + + aOut.EnableOutput(false); + aOut.SetMapMode(aMap); + aRetval.Record(&aOut); + SingleObjectPainter(aOut); + aRetval.Stop(); + aRetval.WindStart(); + aRetval.Move(-aBoundRect.Left(), -aBoundRect.Top()); + aRetval.SetPrefMapMode(aMap); + aRetval.SetPrefSize(aBoundRect.GetSize()); + } + + return aRetval; +} + +SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier /*, bool bAddText */ ) const { + bool bAddText = true; // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE SdrObject* pRetval = NULL; + GraphicType aGraphicType(GetGraphicType()); + GDIMetaFile aMtf; - switch( GetGraphicType() ) + if(isEmbeddedSvg()) + { + // Embedded Svg + // There is currently no helper to create SdrObjects from primitives (even if I'm thinking + // about writing one for some time). To get the roundtrip to SdrObjects it is necessary to + // use the old converter path over the MetaFile mechanism. Create Metafile from Svg + // primitives here pretty directly + aMtf = getMetafileFromEmbeddedSvg(); + aGraphicType = GRAPHIC_GDIMETAFILE; + } + else if(GRAPHIC_GDIMETAFILE == aGraphicType) + { + aMtf = GetTransformedGraphic(SDRGRAFOBJ_TRANSFORMATTR_COLOR|SDRGRAFOBJ_TRANSFORMATTR_MIRROR).GetGDIMetaFile(); + } + + switch(aGraphicType) { case GRAPHIC_GDIMETAFILE: { // Sort into group and return ONLY those objects that can be created from the MetaFile. - SdrObjGroup* pGrp = new SdrObjGroup(); ImpSdrGDIMetaFileImport aFilter(*GetModel()); - aFilter.SetScaleRect(GetSnapRect()); + aFilter.SetScaleRect(aRect); aFilter.SetLayer(GetLayer()); - sal_uInt32 nInsAnz = aFilter.DoImport(GetTransformedGraphic().GetGDIMetaFile(), *pGrp->GetSubList(), 0); + SdrObjGroup* pGrp = new SdrObjGroup(); + sal_uInt32 nInsAnz = aFilter.DoImport(aMtf, *pGrp->GetSubList(), 0); + if(nInsAnz) { + { + // copy transformation + GeoStat aGeoStat(GetGeoStat()); + + if(aGeoStat.nShearWink) + { + aGeoStat.RecalcTan(); + pGrp->NbcShear(aRect.TopLeft(), aGeoStat.nShearWink, aGeoStat.nTan, false); + } + + if(aGeoStat.nDrehWink) + { + aGeoStat.RecalcSinCos(); + pGrp->NbcRotate(aRect.TopLeft(), aGeoStat.nDrehWink, aGeoStat.nSin, aGeoStat.nCos); + } + } + pRetval = pGrp; pGrp->NbcSetLayer(GetLayer()); pGrp->SetModel(GetModel()); - pRetval = ImpConvertAddText(pRetval, bBezier); + + if(bAddText) + { + pRetval = ImpConvertAddText(pRetval, bBezier); + } // convert all children if( pRetval ) { SdrObject* pHalfDone = pRetval; - pRetval = pHalfDone->DoConvertToPolyObj(bBezier); + pRetval = pHalfDone->DoConvertToPolyObj(bBezier + /*, bAddText */ ); // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE SdrObject::Free( pHalfDone ); // resulting object is newly created if( pRetval ) @@ -1068,13 +1175,43 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier) const } } else + { delete pGrp; + } + + // #i118485# convert line and fill + // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE + SdrObject* pLineFill = SdrRectObj::DoConvertToPolyObj(bBezier /*, false */); + + if(pLineFill) + { + if(pRetval) + { + pGrp = dynamic_cast< SdrObjGroup* >(pRetval); + + if(!pGrp) + { + pGrp = new SdrObjGroup(); + + pGrp->NbcSetLayer(GetLayer()); + pGrp->SetModel(GetModel()); + pGrp->GetSubList()->NbcInsertObject(pRetval); + } + + pGrp->GetSubList()->NbcInsertObject(pLineFill, 0); + } + else + { + pRetval = pLineFill; + } + } + break; } case GRAPHIC_BITMAP: { // create basic object and add fill - pRetval = SdrRectObj::DoConvertToPolyObj(bBezier); + pRetval = SdrRectObj::DoConvertToPolyObj(bBezier /*, bAddText */); // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE // save bitmap as an attribute if(pRetval) @@ -1095,7 +1232,7 @@ SdrObject* SdrGrafObj::DoConvertToPolyObj(sal_Bool bBezier) const case GRAPHIC_NONE: case GRAPHIC_DEFAULT: { - pRetval = SdrRectObj::DoConvertToPolyObj(bBezier); + pRetval = SdrRectObj::DoConvertToPolyObj(bBezier /*, bAddText */); // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE break; } } @@ -1240,8 +1377,9 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) if( pGraphic->HasUserData() ) { ::comphelper::LifecycleProxy proxy; + OUString aUserData = pGraphic->GetUserData(); uno::Reference<io::XInputStream> const xStream( - pModel->GetDocumentStream(pGraphic->GetUserData(), proxy)); + pModel->GetDocumentStream(aUserData, proxy)); ::boost::scoped_ptr<SvStream> const pStream( (xStream.is()) ? ::utl::UcbStreamHelper::CreateStream(xStream) @@ -1270,16 +1408,14 @@ IMPL_LINK( SdrGrafObj, ImpSwapHdl, GraphicObject*, pO ) mbIsPreview = true; } - if( !GraphicFilter::GetGraphicFilter().ImportGraphic( aGraphic, - pGraphic->GetUserData(), - *pStream, - GRFILTER_FORMAT_DONTKNOW, - NULL, 0, pFilterData ) ) + if(!GraphicFilter::GetGraphicFilter().ImportGraphic( + aGraphic, aUserData, *pStream, + GRFILTER_FORMAT_DONTKNOW, NULL, 0, pFilterData)) { - const String aUserData( pGraphic->GetUserData() ); + const String aNewUserData( pGraphic->GetUserData() ); pGraphic->SetGraphic( aGraphic ); - pGraphic->SetUserData( aUserData ); + pGraphic->SetUserData( aNewUserData ); // Graphic successfully swapped in. pRet = GRFMGR_AUTOSWAPSTREAM_LOADED; diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 06b7caa2d964..25db389488a2 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1,5 +1,5 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/*h************************************************************************ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -80,7 +80,7 @@ #include <svx/svdetc.hxx> #include <svx/svdview.hxx> #include "unomlstr.hxx" -#include <svtools/chartprettypainter.hxx> +#include <svx/charthelper.hxx> #include <svx/sdr/contact/viewcontactofsdrole2obj.hxx> #include <svx/svdograf.hxx> #include <svx/sdr/properties/oleproperties.hxx> @@ -2030,7 +2030,7 @@ sal_Bool SdrOle2Obj::IsChart() const { if ( !m_bTypeAsked ) { - m_bChart = ChartPrettyPainter::IsChart(xObjRef); + m_bChart = ChartHelper::IsChart(xObjRef); m_bTypeAsked = true; } return m_bChart; diff --git a/svx/source/svdraw/svdorect.cxx b/svx/source/svdraw/svdorect.cxx index 01bc247a8651..a22a33deaaf5 100644 --- a/svx/source/svdraw/svdorect.cxx +++ b/svx/source/svdraw/svdorect.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <svx/svdorect.hxx> #include <math.h> @@ -575,8 +565,12 @@ SdrGluePoint SdrRectObj::GetCornerGluePoint(sal_uInt16 nPosNum) const return aGP; } -SdrObject* SdrRectObj::DoConvertToPolyObj(sal_Bool bBezier) const +// FIXME_REMOVE_WHEN_RE_BASE_COMPLETE +SdrObject* SdrRectObj::DoConvertToPolyObj(sal_Bool bBezier /*, bool bAddText */) const { + // FIXME_REMOVE_WHEN_RE_BASE_COMPLETE + bool bAddText = true; + XPolygon aXP(ImpCalcXPoly(aRect,GetEckenradius())); { // TODO: this is only for the moment, until we have the new TakeContour() aXP.Remove(0,1); @@ -587,12 +581,18 @@ SdrObject* SdrRectObj::DoConvertToPolyObj(sal_Bool bBezier) const aPolyPolygon.removeDoublePoints(); SdrObject* pRet = 0L; - if(!IsTextFrame() || HasFill() || HasLine()) + // small correction: Do not create something when no fill and no line. To + // be sure to not damage something with non-text frames, do this only + // when used with bAddText==false from other converters + if((bAddText && !IsTextFrame()) || HasFill() || HasLine()) { pRet = ImpConvertMakeObj(aPolyPolygon, sal_True, bBezier); } - pRet = ImpConvertAddText(pRet, bBezier); + if(bAddText) + { + pRet = ImpConvertAddText(pRet, bBezier); + } return pRet; } diff --git a/svx/source/svdraw/svdstr.src b/svx/source/svdraw/svdstr.src index 6dfe076d0ef6..d7c03823b6ba 100644 --- a/svx/source/svdraw/svdstr.src +++ b/svx/source/svdraw/svdstr.src @@ -1,30 +1,21 @@ -/************************************************************************* +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ -/* StarView resource file */ + * 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 . + */ #include "svx/svdstr.hrc" // Ab hier gecachte Strings @@ -448,7 +439,21 @@ String STR_ObjNamePluralGRAFMACLNK { Text [ en-US ] = "Linked Mac graphics" ; }; - //////////////////////////////////////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Svg support + +String STR_ObjNameSingulGRAFSVG +{ + Text [ en-US ] = "SVG" ; +}; +String STR_ObjNamePluralGRAFSVG +{ + Text [ en-US ] = "SVGs" ; +}; + +//////////////////////////////////////////////////////////////////////////////////////////////////// + String STR_ObjNameSingulOLE2 { Text [ en-US ] = "embedded object (OLE)" ; @@ -2821,3 +2826,4 @@ String STR_ObjNamePluralFONTWORK Text [ en-US ] = "font works" ; }; +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 275f57087092..df282db62db8 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <vector> #include <editeng/editeng.hxx> @@ -454,24 +444,38 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po //////////////////////////////////////////////////////////////////////////////////////////////////// -Bitmap SdrExchangeView::GetMarkedObjBitmap( sal_Bool bNoVDevIfOneBmpMarked ) const +BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked) const { - Bitmap aBmp; + BitmapEx aBmp; if( AreObjectsMarked() ) { - if( bNoVDevIfOneBmpMarked ) + if(1 == GetMarkedObjectCount()) { - SdrObject* pGrafObjTmp = GetMarkedObjectByIndex( 0 ); - SdrGrafObj* pGrafObj = ( GetMarkedObjectCount() == 1 ) ? PTR_CAST( SdrGrafObj, pGrafObjTmp ) : NULL; + if(bNoVDevIfOneBmpMarked) + { + SdrObject* pGrafObjTmp = GetMarkedObjectByIndex( 0 ); + SdrGrafObj* pGrafObj = ( GetMarkedObjectCount() == 1 ) ? PTR_CAST( SdrGrafObj, pGrafObjTmp ) : NULL; + + if( pGrafObj && ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP ) ) + { + aBmp = pGrafObj->GetTransformedGraphic().GetBitmapEx(); + } + } + else + { + const SdrGrafObj* pSdrGrafObj = dynamic_cast< const SdrGrafObj* >(GetMarkedObjectByIndex(0)); - if( pGrafObj && ( pGrafObj->GetGraphicType() == GRAPHIC_BITMAP ) ) - aBmp = pGrafObj->GetTransformedGraphic().GetBitmap(); + if(pSdrGrafObj && pSdrGrafObj->isEmbeddedSvg()) + { + aBmp = pSdrGrafObj->GetGraphic().getSvgData()->getReplacement(); + } + } } if( !aBmp ) { - const Graphic aGraphic( GetMarkedObjMetaFile( bNoVDevIfOneBmpMarked ) ); + const Graphic aGraphic(GetMarkedObjMetaFile(bNoVDevIfOneBmpMarked)); // #i102089# support user's settings of AA and LineSnap when the MetaFile gets // raster-converted to a bitmap @@ -482,7 +486,7 @@ Bitmap SdrExchangeView::GetMarkedObjBitmap( sal_Bool bNoVDevIfOneBmpMarked ) con aDrawinglayerOpt.IsAntiAliasing(), aDrawinglayerOpt.IsSnapHorVerLinesToDiscrete()); - aBmp = aGraphic.GetBitmap(aParameters); + aBmp = aGraphic.GetBitmapEx(aParameters); } } @@ -491,7 +495,7 @@ Bitmap SdrExchangeView::GetMarkedObjBitmap( sal_Bool bNoVDevIfOneBmpMarked ) con // ----------------------------------------------------------------------------- -GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile( sal_Bool bNoVDevIfOneMtfMarked ) const +GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) const { GDIMetaFile aMtf; @@ -570,7 +574,7 @@ Graphic SdrExchangeView::GetAllMarkedGraphic() const if( ( 1 == GetMarkedObjectCount() ) && GetSdrMarkByIndex( 0 ) ) aRet = SdrExchangeView::GetObjGraphic( pMod, GetMarkedObjectByIndex( 0 ) ); else - aRet = GetMarkedObjMetaFile( sal_False ); + aRet = GetMarkedObjMetaFile(false); } return aRet; @@ -590,10 +594,18 @@ Graphic SdrExchangeView::GetObjGraphic( const SdrModel* pModel, const SdrObject* if(pSdrGrafObj) { - // Make behaviour coherent with metafile - // recording below (which of course also takes - // view-transformed objects) - aRet = pSdrGrafObj->GetTransformedGraphic(); + if(pSdrGrafObj->isEmbeddedSvg()) + { + // get Metafile for Svg content + aRet = pSdrGrafObj->getMetafileFromEmbeddedSvg(); + } + else + { + // Make behaviour coherent with metafile + // recording below (which of course also takes + // view-transformed objects) + aRet = pSdrGrafObj->GetTransformedGraphic(); + } } else if(pSdrOle2Obj) { diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 6599e85b0d0d..de11a0238814 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <string> @@ -1034,8 +1024,7 @@ void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView& rView ) if( !pGrafObj || ( pGrafObj->GetGraphicType() == GRAPHIC_NONE ) || - ( pGrafObj->GetGraphicType() == GRAPHIC_DEFAULT ) || - pGrafObj->HasRenderGraphic() ) + ( pGrafObj->GetGraphicType() == GRAPHIC_DEFAULT )) { bEnableColors = bEnableTransparency = bEnableCrop = false; break; diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 04da106169a1..8a02d44ee0be 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/awt/FontSlant.hpp> @@ -1666,6 +1657,20 @@ bool SvxGraphicObject::getPropertyValueImpl( const ::rtl::OUString& rName, const break; } + case OWN_ATTR_REPLACEMENTGRAFURL: + { + const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject(); + + if(pGrafObj) + { + OUString aURL(RTL_CONSTASCII_USTRINGPARAM(UNO_NAME_GRAPHOBJ_URLPREFIX)); + aURL += OStringToOUString(pGrafObj->GetUniqueID(), RTL_TEXTENCODING_ASCII_US); + rValue <<= aURL; + } + + break; + } + case OWN_ATTR_GRAFSTREAMURL: { const OUString aStreamURL( ( (SdrGrafObj*) mpObj.get() )->GetGrafStreamURL() ); diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 2875ad6f6fd0..975f573f63a4 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1,5 +1,5 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/**h*********************************************************************** * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -711,7 +711,7 @@ uno::Any SvxShape::GetBitmap( sal_Bool bMetaFile /* = sal_False */ ) const throw aRect.Justify(); Size aSize(aRect.GetSize()); - GDIMetaFile aMtf( pView->GetAllMarkedMetaFile() ); + GDIMetaFile aMtf( pView->GetMarkedObjMetaFile() ); if( bMetaFile ) { SvMemoryStream aDestStrm( 65535, 65535 ); @@ -3999,7 +3999,7 @@ SvxShapeText::SvxShapeText( SdrObject* pObject, const SfxItemPropertyMapEntry* p : SvxShape( pObject, pPropertyMap, pPropertySet ), SvxUnoTextBase( ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() ) { if( pObject && pObject->GetModel() ) - SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape * >( this ) ) ) ); + SetEditSource( new SvxTextEditSource( pObject, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape * >( this ) ) ) ); } //---------------------------------------------------------------------- @@ -4013,7 +4013,7 @@ SvxShapeText::~SvxShapeText() throw () void SvxShapeText::Create( SdrObject* pNewObj, SvxDrawPage* pNewPage ) { if( pNewObj && (NULL == GetEditSource())) - SetEditSource( new SvxTextEditSource( pNewObj, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape* >(this) ) ) ); + SetEditSource( new SvxTextEditSource( pNewObj, 0, static_cast< cppu::OWeakObject * >( static_cast< SvxShape* >(this) ) ) ); SvxShape::Create( pNewObj, pNewPage ); } @@ -4247,12 +4247,12 @@ uno::Any SAL_CALL SvxShapeRect::queryAggregation( const uno::Type & rType ) thro void SAL_CALL SvxShapeRect::acquire() throw() { - SvxShapeText::acquire(); + SvxShapeText::acquire(); } void SAL_CALL SvxShapeRect::release() throw() { - SvxShapeText::release(); + SvxShapeText::release(); } //---------------------------------------------------------------------- // XServiceInfo diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx index 215c8fe88e86..d428c147b195 100644 --- a/svx/source/xml/xmlgrhlp.cxx +++ b/svx/source/xml/xmlgrhlp.cxx @@ -1,30 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* +/* + * This file is part of the LibreOffice project. * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * 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/. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <comphelper/string.hxx> #include <sal/macros.h> @@ -152,7 +143,7 @@ SvXMLGraphicInputStream::SvXMLGraphicInputStream( const ::rtl::OUString& rGraphi { pStm->SetVersion( SOFFICE_FILEFORMAT_8 ); pStm->SetCompressMode( COMPRESSMODE_ZBITMAP ); - ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC ); + ( (GDIMetaFile&) aGraphic.GetGDIMetaFile() ).Write( *pStm ); bRet = ( pStm->GetError() == 0 ); } } @@ -638,7 +629,7 @@ sal_Bool SvXMLGraphicHelper::ImplWriteGraphic( const ::rtl::OUString& rPictureSt pStream->Write( rLink.GetData(), rLink.GetDataSize() ); } else - rMtf.Write( *pStream, GDIMETAFILE_WRITE_REPLACEMENT_RENDERGRAPHIC ); + rMtf.Write( *pStream ); bRet = ( pStream->GetError() == 0 ); } @@ -720,7 +711,7 @@ void SvXMLGraphicHelper::ImplInsertGraphicURL( const ::rtl::OUString& rURLStr, s case( GFX_LINK_TYPE_NATIVE_WMF ): aExtension = String( ".wmf" ); break; case( GFX_LINK_TYPE_NATIVE_MET ): aExtension = String( ".met" ); break; case( GFX_LINK_TYPE_NATIVE_PCT ): aExtension = String( ".pct" ); break; - case( GFX_LINK_TYPE_NATIVE_SVG ): + case( GFX_LINK_TYPE_NATIVE_SVG ): // backward-compat kludge: since no released OOo // version to date can handle svg properly, wrap it up // into an svm. slight catch22 here, since strict ODF diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx index b5df3c7f359b..581bcd0104cd 100644 --- a/svx/source/xoutdev/xattr2.cxx +++ b/svx/source/xoutdev/xattr2.cxx @@ -1,32 +1,24 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite +/* + * This file is part of the LibreOffice project. * - * This file is part of OpenOffice.org. + * 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/. * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ + * 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 . + */ #include <com/sun/star/drawing/LineJoint.hpp> +#include <com/sun/star/drawing/LineCap.hpp> #include <com/sun/star/uno/Any.hxx> #include <svx/dialogs.hrc> @@ -290,6 +282,150 @@ sal_uInt16 XLineJointItem::GetValueCount() const return 5; } +//----------------------- +// class XLineCapItem - +//----------------------- + +TYPEINIT1_AUTOFACTORY(XLineCapItem, SfxEnumItem); + +// ----------------------------------------------------------------------------- + +XLineCapItem::XLineCapItem(com::sun::star::drawing::LineCap eLineCap) +: SfxEnumItem(XATTR_LINECAP, sal::static_int_cast< sal_uInt16 >(eLineCap)) +{ +} + +// ----------------------------------------------------------------------------- + +XLineCapItem::XLineCapItem( SvStream& rIn ) +: SfxEnumItem(XATTR_LINECAP, rIn) +{ +} + +// ----------------------------------------------------------------------------- + +sal_uInt16 XLineCapItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/) const +{ + return 1; +} + +// ----------------------------------------------------------------------------- + +SfxPoolItem* XLineCapItem::Create( SvStream& rIn, sal_uInt16 nVer ) const +{ + XLineCapItem* pRet = new XLineCapItem( rIn ); + + if(nVer < 1) + pRet->SetValue(com::sun::star::drawing::LineCap_BUTT); + + return pRet; +} + +// ----------------------------------------------------------------------------- + +SfxPoolItem* XLineCapItem::Clone(SfxItemPool* /*pPool*/) const +{ + return new XLineCapItem( *this ); +} + +// ----------------------------------------------------------------------------- + +SfxItemPresentation XLineCapItem::GetPresentation( SfxItemPresentation ePres, SfxMapUnit /*eCoreUnit*/, + SfxMapUnit /*ePresUnit*/, XubString& rText, const IntlWrapper*) const +{ + rText.Erase(); + + switch( ePres ) + { + case SFX_ITEM_PRESENTATION_NONE: return ePres; + + case SFX_ITEM_PRESENTATION_COMPLETE: + case SFX_ITEM_PRESENTATION_NAMELESS: + { + sal_uInt16 nId = 0; + + switch( GetValue() ) + { + default: /*com::sun::star::drawing::LineCap_BUTT*/ + nId = RID_SVXSTR_LINECAP_BUTT; + break; + + case(com::sun::star::drawing::LineCap_ROUND): + nId = RID_SVXSTR_LINECAP_ROUND; + break; + + case(com::sun::star::drawing::LineCap_SQUARE): + nId = RID_SVXSTR_LINECAP_SQUARE; + break; + } + + if( nId ) + rText = SVX_RESSTR( nId ); + + return ePres; + } + default: + return SFX_ITEM_PRESENTATION_NONE; + } +} + +// ----------------------------------------------------------------------------- + +bool XLineCapItem::QueryValue( ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const +{ + const com::sun::star::drawing::LineCap eCap(GetValue()); + rVal <<= eCap; + return true; +} + +// ----------------------------------------------------------------------------- + +bool XLineCapItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uInt8 /*nMemberId*/) +{ + com::sun::star::drawing::LineCap eUnoCap; + + if(!(rVal >>= eUnoCap)) + { + // also try an int (for Basic) + sal_Int32 nLJ(0); + + if(!(rVal >>= nLJ)) + { + return false; + } + + eUnoCap = (com::sun::star::drawing::LineCap)nLJ; + } + + OSL_ENSURE(com::sun::star::drawing::LineCap_BUTT == eUnoCap + || com::sun::star::drawing::LineCap_ROUND == eUnoCap + || com::sun::star::drawing::LineCap_SQUARE == eUnoCap, "Unknown enum value in XATTR_LINECAP (!)"); + + SetValue(sal::static_int_cast< sal_uInt16 >(eUnoCap)); + + return true; +} + +// ----------------------------------------------------------------------------- + +sal_uInt16 XLineCapItem::GetValueCount() const +{ + // don't forget to update the api interface also + return 3; +} + +// ----------------------------------------------------------------------------- + +com::sun::star::drawing::LineCap XLineCapItem::GetValue() const +{ + const com::sun::star::drawing::LineCap eRetval((com::sun::star::drawing::LineCap)SfxEnumItem::GetValue()); + OSL_ENSURE(com::sun::star::drawing::LineCap_BUTT == eRetval + || com::sun::star::drawing::LineCap_ROUND == eRetval + || com::sun::star::drawing::LineCap_SQUARE == eRetval, "Unknown enum value in XATTR_LINECAP (!)"); + + return eRetval; +} + //------------------------------ // class XFillTransparenceItem //------------------------------ diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 9cb1a4f53a28..9b577b186bfd 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -1,31 +1,21 @@ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite +/* + * This file is part of the LibreOffice project. * - * This file is part of OpenOffice.org. + * 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/. * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. + * This file incorporates work covered by the following license notice: * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - + * 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 . + */ #include <svx/xtable.hxx> #include "svx/xattr.hxx" @@ -36,7 +26,7 @@ /************************************************************************* |* -|* Konstruktor +|* Constructor |* \************************************************************************/ @@ -90,6 +80,7 @@ XOutdevItemPool::XOutdevItemPool( mppLocalPoolDefaults[XATTR_LINEENDCENTER -XATTR_START] = new XLineEndCenterItem; mppLocalPoolDefaults[XATTR_LINETRANSPARENCE -XATTR_START] = new XLineTransparenceItem; mppLocalPoolDefaults[XATTR_LINEJOINT -XATTR_START] = new XLineJointItem; + mppLocalPoolDefaults[XATTR_LINECAP -XATTR_START] = new XLineCapItem; mppLocalPoolDefaults[XATTR_FILLSTYLE -XATTR_START] = new XFillStyleItem; mppLocalPoolDefaults[XATTR_FILLCOLOR -XATTR_START] = new XFillColorItem (aNullStr,aNullFillCol); mppLocalPoolDefaults[XATTR_FILLGRADIENT -XATTR_START] = new XFillGradientItem(aNullGrad); |