[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sc/source sw/source writerfilter/source

2023-09-25 Thread Tomaž Vajngerl (via logerrit)
 include/oox/export/drawingml.hxx  |6 ++---
 oox/source/export/drawingml.cxx   |   26 --
 oox/source/export/vmlexport.cxx   |4 +--
 sc/source/filter/excel/xeescher.cxx   |2 -
 sw/source/filter/ww8/docxattributeoutput.cxx  |6 ++---
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   19 
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |8 +-
 7 files changed, 36 insertions(+), 35 deletions(-)

New commits:
commit c90de36ede6d35e2cf1ebea195e0ff28f618f319
Author: Tomaž Vajngerl 
AuthorDate: Wed Sep 20 21:22:54 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Sep 25 20:26:31 2023 +0200

change bool header or footer parameter to use enum type instead

Is much more readable.

Change-Id: Ie81aaf344758182915796b18efbe25d3f45df4b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157236
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 72b35d7d544d..13836906c53e 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3460,21 +3460,22 @@ void 
DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, b
 }
 }
 
-void DomainMapper_Impl::PushPageHeaderFooter(bool bHeader, 
SectionPropertyMap::PageType eType)
+void DomainMapper_Impl::PushPageHeaderFooter(PagePartType ePagePartType, 
SectionPropertyMap::PageType eType)
 {
 m_bSaveParaHadField = m_bParaHadField;
 m_aHeaderFooterStack.push(HeaderFooterContext(m_bTextInserted, 
m_nTableDepth));
 m_bTextInserted = false;
 m_nTableDepth = 0;
 
-const PropertyIds ePropIsOn = bHeader? PROP_HEADER_IS_ON: 
PROP_FOOTER_IS_ON;
-const PropertyIds ePropShared = bHeader? PROP_HEADER_IS_SHARED: 
PROP_FOOTER_IS_SHARED;
-const PropertyIds ePropTextLeft = bHeader? PROP_HEADER_TEXT_LEFT: 
PROP_FOOTER_TEXT_LEFT;
-const PropertyIds ePropText = bHeader? PROP_HEADER_TEXT: PROP_FOOTER_TEXT;
+bool bHeader = ePagePartType == PagePartType::Header;
+
+const PropertyIds ePropIsOn = bHeader ? PROP_HEADER_IS_ON: 
PROP_FOOTER_IS_ON;
+const PropertyIds ePropShared = bHeader ? PROP_HEADER_IS_SHARED: 
PROP_FOOTER_IS_SHARED;
+const PropertyIds ePropTextLeft = bHeader ? PROP_HEADER_TEXT_LEFT: 
PROP_FOOTER_TEXT_LEFT;
+const PropertyIds ePropText = bHeader ? PROP_HEADER_TEXT: PROP_FOOTER_TEXT;
 
 m_bDiscardHeaderFooter = true;
-m_eInHeaderFooterImport
-= bHeader ? HeaderFooterImportState::header : 
HeaderFooterImportState::footer;
+m_eInHeaderFooterImport = bHeader ? HeaderFooterImportState::header : 
HeaderFooterImportState::footer;
 
 //get the section context
 PropertyMapPtr pContext = 
DomainMapper_Impl::GetTopContextOfType(CONTEXT_SECTION);
@@ -3560,12 +3561,12 @@ void DomainMapper_Impl::PushPageHeaderFooter(bool 
bHeader, SectionPropertyMap::P
 
 void DomainMapper_Impl::PushPageHeader(SectionPropertyMap::PageType eType)
 {
-PushPageHeaderFooter(/* bHeader = */ true, eType);
+PushPageHeaderFooter(PagePartType::Header, eType);
 }
 
 void DomainMapper_Impl::PushPageFooter(SectionPropertyMap::PageType eType)
 {
-PushPageHeaderFooter(/* bHeader = */ false, eType);
+PushPageHeaderFooter(PagePartType::Footer, eType);
 }
 
 void DomainMapper_Impl::PopPageHeaderFooter()
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx 
b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index c19de5a5c4b9..676a0d3196d9 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -426,6 +426,12 @@ struct SymbolData
 { }
 };
 
+enum class PagePartType
+{
+Header,
+Footer
+};
+
 class DomainMapper;
 class DomainMapper_Impl final
 {
@@ -1194,7 +1200,7 @@ public:
 OUString getFontNameForTheme(const Id id);
 
 private:
-void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType 
eType);
+void PushPageHeaderFooter(PagePartType ePagePartType, 
SectionPropertyMap::PageType eType);
 // Start a new index section; if needed, finish current paragraph
 css::uno::Reference 
StartIndexSectionChecked(const OUString& sServiceName);
 std::vector > 
m_vTextFramesForChaining ;
commit 33c347fb3b0fbbae9c1005b1ca7a6105284a6d31
Author: Tomaž Vajngerl 
AuthorDate: Sun Sep 17 23:00:17 2023 +0200
Commit: Tomaž Vajngerl 
CommitDate: Mon Sep 25 20:26:24 2023 +0200

oox: remove returning sRelId and rename WriteImage

Rename WriteImage -> writeGraphicToStorage to make it more clear
what the method does.

Remove returning the rel ID string in some methods that write the
graphic into the stream (or the call chain), as it is never used
later on, so it is better to not return it if it is not used (it
could be abused).


[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sc/source

2023-08-11 Thread Caolán McNamara (via logerrit)
 include/oox/vml/vmlshape.hxx|8 +---
 oox/source/vml/vmlshape.cxx |   25 +
 sc/source/filter/oox/commentsbuffer.cxx |7 ++-
 3 files changed, 24 insertions(+), 16 deletions(-)

New commits:
commit 6945d031e759823ab52bdf077e43196b67f594a4
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 11:37:28 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 11 18:13:13 2023 +0200

move setting properties into note comments from oox to sc

no change in behavior intended, the SdrCaption doesn't support
the skipped conditions

Change-Id: Id909ae4ed115c1ad3398d2a62c6432ff1dfde453
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155585
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 2aa2163653de..e95e44053330 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -267,9 +267,11 @@ public:
 const css::uno::Reference< css::drawing::XShapes 
>& rxShapes,
 const ShapeParentAnchor* pParentAnchor = nullptr ) 
const;
 
-/** Converts formatting into the passed existing XShape and returns 
position. */
-css::awt::Rectangle convertFormatting(
-const css::uno::Reference< css::drawing::XShape >& 
rxShape ) const;
+/** Returns bounds of Shape */
+css::awt::Rectangle getShapeRectangle() const;
+
+/** Collects common shape properties such as formatting attributes. */
+oox::drawingml::ShapePropertyMap makeShapePropertyMap() const;
 
 void setContainer(ShapeContainer* pContainer);
 ShapeContainer* getContainer() const;
@@ -295,9 +297,6 @@ protected:
 css::awt::Rectangle calcShapeRectangle(
 const ShapeParentAnchor* pParentAnchor ) const;
 
-/** Collects common shape properties such as formatting attributes. */
-oox::drawingml::ShapePropertyMap makeShapePropertyMap() const;
-
 /** Converts common shape properties such as formatting attributes. */
 voidconvertShapeProperties(
 const css::uno::Reference< css::drawing::XShape >& 
rxShape ) const;
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index c297fc1563bb..81ba42ba0a48 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -484,20 +484,11 @@ Reference< XShape > ShapeBase::convertAndInsert( const 
Reference< XShapes >& rxS
 return xShape;
 }
 
-awt::Rectangle ShapeBase::convertFormatting( const Reference< XShape >& 
rxShape ) const
+awt::Rectangle ShapeBase::getShapeRectangle() const
 {
-if( !rxShape.is() )
-return awt::Rectangle();
-
 /*  Calculate shape rectangle. Applications may do something special
 according to some imported shape client data (e.g. Excel cell anchor). 
*/
-awt::Rectangle aShapeRect = calcShapeRectangle( nullptr );
-
-// convert the shape, if the calculated rectangle is not empty
-if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) )
-convertShapeProperties( rxShape );
-
-return aShapeRect;
+return calcShapeRectangle(nullptr);
 }
 
 void ShapeBase::setContainer(ShapeContainer* pContainer) { mpContainer = 
pContainer; }
diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index 555ddad3a924..55bcb7e2cc73 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -183,11 +184,15 @@ void Comment::finalizeImport()
 if( const ::oox::vml::ShapeBase* pVmlNoteShape = 
getVmlDrawing().getNoteShape( maModel.maRange.aStart ) )
 {
 // position and formatting
-css::awt::Rectangle aShapeRect = 
pVmlNoteShape->convertFormatting(xAnnoShape);
+css::awt::Rectangle aShapeRect = 
pVmlNoteShape->getShapeRectangle();
 if (aShapeRect.Width > 0 || aShapeRect.Height > 0)
 {
 xAnnoShape->setPosition(css::awt::Point(aShapeRect.X, 
aShapeRect.Y));
 xAnnoShape->setSize(css::awt::Size(aShapeRect.Width, 
aShapeRect.Height));
+
+::oox::drawingml::ShapePropertyMap 
aPropMap(pVmlNoteShape->makeShapePropertyMap());
+css::uno::Reference xShape(xAnnoShape);
+PropertySet(xShape).setProperties(aPropMap);
 }
 // visibility
 bVisible = pVmlNoteShape->getTypeModel().mbVisible;
commit c88855c45a675cf28e2cfe4fa261c2b0339f5898
Author: Caolán McNamara 
AuthorDate: Fri Aug 11 11:15:22 2023 +0100
Commit: Caolán McNamara 
CommitDate: Fri Aug 11 18:13:04 2023 +0200

split ShapeBase::convertShapeProperties into two parts

Change-Id: I62f42e54c776f15ea83c5fc861bb4f4ff899e891
Reviewed-on: 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa

2023-08-04 Thread Szymon Kłos (via logerrit)
 include/oox/drawingml/shape.hxx|3 ++
 oox/source/drawingml/shape.cxx |2 +
 oox/source/drawingml/shapecontext.cxx  |2 +
 oox/source/drawingml/textparagraphproperties.cxx   |2 +
 oox/source/ppt/pptshape.cxx|4 ++
 sd/qa/unit/data/pptx/formatting-bullet-indent.pptx |binary
 sd/qa/unit/data/pptx/shape-master-text.pptx|binary
 sd/qa/unit/import-tests2.cxx   |   29 +
 8 files changed, 42 insertions(+)

New commits:
commit a68d39c34ea1e418deadc0a5ee2acc2019a582cf
Author: Szymon Kłos 
AuthorDate: Thu Aug 3 16:53:36 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Aug 4 10:17:33 2023 +0200

oox: default first line indent is 0

When First Line Indent was defined in paragraph properties
Impress remembered that value and applied for the next
paragraph. Let's set it to default value (0) if property is
not set explicitly.

Change-Id: I3b075fab594fce64d953553634a49b9769c9341c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155336
Tested-by: Jenkins
Reviewed-by: Szymon Kłos 

diff --git a/oox/source/drawingml/textparagraphproperties.cxx 
b/oox/source/drawingml/textparagraphproperties.cxx
index 8122c4e53324..df3d36a21003 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -494,6 +494,8 @@ void TextParagraphProperties::pushToPropSet( const 
::oox::core::XmlFilterBase* p
 aPropSet.setProperty( PROP_ParaTabStops, aSeq );
 }
 }
+else
+aPropSet.setProperty( PROP_ParaFirstLineIndent, 0);
 
 if ( moDefaultTabSize )
 {
diff --git a/sd/qa/unit/data/pptx/formatting-bullet-indent.pptx 
b/sd/qa/unit/data/pptx/formatting-bullet-indent.pptx
new file mode 100644
index ..3140d7ce57f8
Binary files /dev/null and b/sd/qa/unit/data/pptx/formatting-bullet-indent.pptx 
differ
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index 0b168ef2bd91..4d197b364449 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1900,6 +1900,24 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testShapeMasterText)
 CPPUNIT_ASSERT_EQUAL(OUString("Custom"), xRun->getString());
 }
 
+CPPUNIT_TEST_FIXTURE(SdImportTest2, testIndentDuplication)
+{
+createSdImpressDoc("pptx/formatting-bullet-indent.pptx");
+uno::Reference xShape(getShapeFromPage(2, 0));
+
+uno::Reference const 
xParagraph1(getParagraphFromShape(0, xShape),
+  
uno::UNO_QUERY_THROW);
+sal_Int32 nIndent1;
+xParagraph1->getPropertyValue("ParaFirstLineIndent") >>= nIndent1;
+CPPUNIT_ASSERT_EQUAL(sal_Int32(2500), nIndent1);
+
+uno::Reference const 
xParagraph2(getParagraphFromShape(1, xShape),
+  
uno::UNO_QUERY_THROW);
+sal_Int32 nIndent2;
+xParagraph2->getPropertyValue("ParaFirstLineIndent") >>= nIndent2;
+CPPUNIT_ASSERT_EQUAL(sal_Int32(0), nIndent2);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit ae3b97a69688553e6c40ef4b64655db09d5a0f5e
Author: Szymon Kłos 
AuthorDate: Thu Jul 27 08:43:59 2023 +0200
Commit: Szymon Kłos 
CommitDate: Fri Aug 4 10:17:25 2023 +0200

pptx: import shape text from master page

If shape has custom text defined in master page
but no text itself - don't prefer placeholder text
but text from master page.

Change-Id: Id4f7aeca0e74ecd8565905cd656a182c1195fa30
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154980
Tested-by: Jenkins CollaboraOffice 
Reviewed-by: Henry Castro 
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155335
Tested-by: Szymon Kłos 
Reviewed-by: Szymon Kłos 

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index ccf477bef805..4c8be792e7f6 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -237,6 +237,8 @@ public:
 voidsetTxbxHasLinkedTxtBox( const bool rhs){ 
mbHasLinkedTxbx = rhs; };
 const LinkedTxbxAttr& getLinkedTxbxAttributes() const { return 
maLinkedTxbxAttr; };
 boolisLinkedTxbx() const { return mbHasLinkedTxbx; };
+voidsetHasCustomPrompt(bool bValue) { mbHasCustomPrompt = 
bValue; }
+boolhasCustomPrompt() { return mbHasCustomPrompt; }
 
 void setZOrder(sal_Int32 nZOrder) { mnZOrder = nZOrder; }
 
@@ -393,6 +395,7 @@ private:
 bool mbTextBox; ///< This shape has a textbox.
 LinkedTxbxAttr  maLinkedTxbxAttr;
 boolmbHasLinkedTxbx; // this text box has 
linked text box ?
+boolmbHasCustomPrompt; // indicates that it's 
not a generic placeholder
 
 css::uno::Sequence maDiagramDoms;
 
diff 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sc/source

2023-06-21 Thread Tomaž Vajngerl (via logerrit)
 include/oox/drawingml/color.hxx  |   10 +++
 oox/source/drawingml/color.cxx   |   84 +--
 sc/source/filter/inc/stylesbuffer.hxx|3 +
 sc/source/filter/oox/stylesbuffer.cxx|   17 --
 sc/source/ui/theme/ThemeColorChanger.cxx |   25 -
 5 files changed, 127 insertions(+), 12 deletions(-)

New commits:
commit ea1cd4993be992b89930db4811d08a4a51b1f68d
Author: Tomaž Vajngerl 
AuthorDate: Fri May 12 23:21:22 2023 +0900
Commit: Tomaž Vajngerl 
CommitDate: Wed Jun 21 16:33:57 2023 +0200

sc: OOXML import of theme colors for char and background colors

Change-Id: I8209238927bb425e8e306352f1fa78d63378f005
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151707
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 245e655d7c78..ea02ef8a03e4 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -37,6 +37,7 @@ namespace oox { class GraphicHelper; }
 namespace oox::drawingml
 {
 
+model::ThemeColorType schemeTokenToThemeColorType(sal_uInt32 nToken);
 model::ThemeColorType schemeNameToThemeColorType(OUString const& rSchemeName);
 
 class OOX_DLLPUBLIC Color
@@ -107,6 +108,13 @@ public:
 sal_Int16   getLumMod() const;
 sal_Int16   getLumOff() const;
 
+model::ThemeColorType getThemeColorType() const
+{
+return meThemeColorType;
+}
+
+model::ComplexColor createComplexColor(const GraphicHelper& 
rGraphicHelper, sal_Int16 nPhClrTheme) const;
+
 /** Returns the unaltered list of transformations for interoperability 
purposes */
 const css::uno::Sequence< css::beans::PropertyValue >& 
getTransformations() const { return maInteropTransformations;}
 
@@ -160,8 +168,8 @@ private:
 mutable sal_Int32   mnC2;   /// Green, green%, saturation, or 
system default RGB.
 mutable sal_Int32   mnC3;   /// Blue, blue%, or luminance.
 sal_Int32   mnAlpha;/// Alpha value (color opacity).
-
 OUStringmsSchemeName;   /// Scheme name from the a:schemeClr 
element for interoperability purposes
+model::ThemeColorType meThemeColorType;
 css::uno::Sequence< css::beans::PropertyValue >
 maInteropTransformations;   /// Unaltered list of 
transformations for interoperability purposes
 };
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index 91543b3ef123..d13e29839227 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -209,7 +209,7 @@ void lclOffValue( sal_Int32& ornValue, sal_Int32 nOff, 
sal_Int32 nMax = MAX_PERC
 ornValue = getLimitedValue< sal_Int32, sal_Int32 >( ornValue + nOff, 0, 
nMax );
 }
 
-constexpr frozen::unordered_map aSchemeColorNameToIndex
+constexpr frozen::unordered_map constSchemeColorNameToIndex
 {
 { u"dk1", model::ThemeColorType::Dark1 },
 { u"lt1", model::ThemeColorType::Light1 },
@@ -239,12 +239,51 @@ constexpr frozen::unordered_map
 { u"followedHyperlink", model::ThemeColorType::FollowedHyperlink }
 };
 
+constexpr frozen::unordered_map 
constThemeColorTokenMap
+{
+{ XML_dk1, model::ThemeColorType::Dark1 },
+{ XML_lt1, model::ThemeColorType::Light1 },
+{ XML_dk2, model::ThemeColorType::Dark2 },
+{ XML_lt2, model::ThemeColorType::Light2 },
+{ XML_accent1, model::ThemeColorType::Accent1 },
+{ XML_accent2, model::ThemeColorType::Accent2 },
+{ XML_accent3, model::ThemeColorType::Accent3 },
+{ XML_accent4, model::ThemeColorType::Accent4 },
+{ XML_accent5, model::ThemeColorType::Accent5 },
+{ XML_accent6, model::ThemeColorType::Accent6 },
+{ XML_hlink, model::ThemeColorType::Hyperlink },
+{ XML_folHlink, model::ThemeColorType::FollowedHyperlink },
+{ XML_tx1, model::ThemeColorType::Dark1 },
+{ XML_bg1, model::ThemeColorType::Light1 },
+{ XML_tx2, model::ThemeColorType::Dark2 },
+{ XML_bg2, model::ThemeColorType::Light2 },
+{ XML_dark1, model::ThemeColorType::Dark1 },
+{ XML_light1, model::ThemeColorType::Light1 },
+{ XML_dark2, model::ThemeColorType::Dark2 },
+{ XML_light2, model::ThemeColorType::Light2 },
+{ XML_text1, model::ThemeColorType::Dark1 },
+{ XML_background1, model::ThemeColorType::Light1 },
+{ XML_text2, model::ThemeColorType::Dark2 },
+{ XML_background2, model::ThemeColorType::Light2 },
+{ XML_hyperlink, model::ThemeColorType::Hyperlink },
+{ XML_followedHyperlink, model::ThemeColorType::FollowedHyperlink },
+};
+
 } // end anonymous namespace
 
 model::ThemeColorType schemeNameToThemeColorType(OUString const& rSchemeName)
 {
-auto aIterator = aSchemeColorNameToIndex.find(rSchemeName);
-if (aIterator == aSchemeColorNameToIndex.end())
+auto aIterator = constSchemeColorNameToIndex.find(rSchemeName);
+if (aIterator == constSchemeColorNameToIndex.end())
+return 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source vcl/unx

2021-06-16 Thread Caolán McNamara (via logerrit)
 include/oox/export/drawingml.hxx |   13 ++-
 include/oox/export/shapes.hxx|2 -
 oox/source/export/drawingml.cxx  |   68 +--
 oox/source/export/shapes.cxx |4 +-
 vcl/unx/gtk3/gtkinst.cxx |   19 ++
 5 files changed, 92 insertions(+), 14 deletions(-)

New commits:
commit 6c4e61fcc73574eb5d55cc0bcb3c6ff8d69debc6
Author: Caolán McNamara 
AuthorDate: Wed Jun 16 09:18:00 2021 +0100
Commit: Caolán McNamara 
CommitDate: Wed Jun 16 15:01:40 2021 +0200

gtk4: reenable some more working dialogs

Change-Id: Iaa8d77b231f8366ff4c33221691e9a3cadb73fa4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117312
Tested-by: Jenkins
Reviewed-by: Caolán McNamara 

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index b8ece3292b5d..6e5917a40356 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -22245,12 +22245,15 @@ weld::Builder* 
GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
 rUIFile != "cui/ui/areatabpage.ui" &&
 rUIFile != "cui/ui/autocorrectdialog.ui" &&
 rUIFile != "cui/ui/bitmaptabpage.ui" &&
+rUIFile != "cui/ui/borderpage.ui" &&
 rUIFile != "cui/ui/breaknumberoption.ui" &&
 rUIFile != "cui/ui/colorpage.ui" &&
 rUIFile != "cui/ui/colorpickerdialog.ui" &&
 rUIFile != "cui/ui/editdictionarydialog.ui" &&
 rUIFile != "cui/ui/eventassigndialog.ui" &&
 rUIFile != "cui/ui/eventassignpage.ui" &&
+rUIFile != "cui/ui/gradientpage.ui" &&
+rUIFile != "cui/ui/hatchpage.ui" &&
 rUIFile != "cui/ui/hangulhanjaadddialog.ui" &&
 rUIFile != "cui/ui/hangulhanjaconversiondialog.ui" &&
 rUIFile != "cui/ui/hangulhanjaeditdictdialog.ui" &&
@@ -22268,13 +22271,20 @@ weld::Builder* 
GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString&
 rUIFile != "cui/ui/macroassignpage.ui" &&
 rUIFile != "cui/ui/macroselectordialog.ui" &&
 rUIFile != "cui/ui/namedialog.ui" &&
+rUIFile != "cui/ui/numberingoptionspage.ui" &&
+rUIFile != "cui/ui/numberingpositionpage.ui" &&
 rUIFile != "cui/ui/objectnamedialog.ui" &&
 rUIFile != "cui/ui/objecttitledescdialog.ui" &&
 rUIFile != "cui/ui/optjsearchpage.ui" &&
 rUIFile != "cui/ui/optlingupage.ui" &&
 rUIFile != "cui/ui/optnewdictionarydialog.ui" &&
 rUIFile != "cui/ui/pastespecial.ui" &&
+rUIFile != "cui/ui/patterntabpage.ui" &&
 rUIFile != "cui/ui/percentdialog.ui" &&
+rUIFile != "cui/ui/pickbulletpage.ui" &&
+rUIFile != "cui/ui/pickgraphicpage.ui" &&
+rUIFile != "cui/ui/picknumberingpage.ui" &&
+rUIFile != "cui/ui/pickoutlinepage.ui" &&
 rUIFile != "cui/ui/qrcodegen.ui" &&
 rUIFile != "cui/ui/scriptorganizer.ui" &&
 rUIFile != "cui/ui/searchattrdialog.ui" &&
@@ -22286,6 +22296,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
 rUIFile != "cui/ui/thesaurus.ui" &&
 rUIFile != "cui/ui/tipofthedaydialog.ui" &&
 rUIFile != "cui/ui/toolbarmodedialog.ui" &&
+rUIFile != "cui/ui/transparencytabpage.ui" &&
 rUIFile != "cui/ui/wordcompletionpage.ui" &&
 rUIFile != "cui/ui/zoomdialog.ui" &&
 rUIFile != "filter/ui/pdfgeneralpage.ui" &&
@@ -22313,6 +22324,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
 rUIFile != "sfx/ui/password.ui" &&
 rUIFile != "sfx/ui/printeroptionsdialog.ui" &&
 rUIFile != "sfx/ui/safemodequerydialog.ui" &&
+rUIFile != "sfx/ui/saveastemplatedlg.ui" &&
 rUIFile != "sfx/ui/securityinfopage.ui" &&
 rUIFile != "sfx/ui/singletabdialog.ui" &&
 rUIFile != "sfx/ui/templatecategorydlg.ui" &&
@@ -22330,6 +22342,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
 rUIFile != "svx/ui/chineseconversiondialog.ui" &&
 rUIFile != "svx/ui/chinesedictionary.ui" &&
 rUIFile != "svx/ui/colorwindow.ui" &&
+rUIFile != "svx/ui/docrecoveryprogressdialog.ui" &&
 rUIFile != "svx/ui/docrecoverysavedialog.ui" &&
 rUIFile != "svx/ui/findreplacedialog.ui" &&
 rUIFile != "svx/ui/fontworkgallerydialog.ui" &&
@@ -22399,6 +22412,7 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* 
pParent, const OUString&
 rUIFile != "modules/smath/ui/symdefinedialog.ui" &&
 rUIFile != "modules/swriter/ui/autotext.ui" &&
 rUIFile != "modules/swriter/ui/bibliographyentry.ui" &&
+rUIFile != "modules/swriter/ui/bulletsandnumbering.ui" &&
 rUIFile != "modules/swriter/ui/columndialog.ui" &&
 rUIFile != "modules/swriter/ui/columnpage.ui" &&
 rUIFile != "modules/swriter/ui/editcategories.ui" &&
@@ -22407,6 +22421,10 @@ weld::Builder* 
GtkInstance::CreateBuilder(weld::Widget* 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/source tools/source

2019-02-01 Thread Libreoffice Gerrit user
 include/oox/export/drawingml.hxx |   13 +++--
 oox/source/export/drawingml.cxx  |2 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |2 +-
 sw/source/filter/ww8/docxsdrexport.cxx   |2 +-
 tools/source/generic/gen.cxx |   11 +++
 5 files changed, 13 insertions(+), 17 deletions(-)

New commits:
commit d938920433ed28897f41a2dde89ba296ce89bfd5
Author: Miklos Vajna 
AuthorDate: Fri Feb 1 23:44:38 2019 +0100
Commit: Miklos Vajna 
CommitDate: Sat Feb 2 08:33:46 2019 +0100

oox: OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY() can be a template

Change-Id: I9d3d371e3942e3f7ba3f2fabfb31e5d339c41ee0
Reviewed-on: https://gerrit.libreoffice.org/67264
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 24adf475be16..fbcc25fb3db1 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -42,12 +42,6 @@
 #include 
 #include 
 
-#ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY
-// Our rotation is counter-clockwise and is in 100ths of a degree.
-// drawingML rotation is clockwise and is in 6ths of a degree.
-#define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) 
((2160-input*600)%2160)
-#endif
-
 class Graphic;
 class SdrObjCustomShape;
 
@@ -102,6 +96,13 @@ namespace core {
 
 namespace drawingml {
 
+// Our rotation is counter-clockwise and is in 100ths of a degree.
+// drawingML rotation is clockwise and is in 6ths of a degree.
+template  T ExportRotateClockwisify(T input)
+{
+return ((2160 - input * 600) % 2160);
+}
+
 /// Interface to be implemented by the parent exporter that knows how to 
handle shape text.
 class OOX_DLLPUBLIC DMLTextExport
 {
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index cbc39f946a00..91961155294a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1493,7 +1493,7 @@ void DrawingML::WriteShapeTransformation( const 
Reference< XShape >& rXShape, sa
 nRotation = nRotation * -1 + 36000;
 
 WriteTransformation(tools::Rectangle(Point(aPos.X, aPos.Y), 
Size(aSize.Width, aSize.Height)), nXmlNamespace,
-bFlipHWrite, bFlipVWrite, 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRotation), IsGroupShape( rXShape ));
+bFlipHWrite, bFlipVWrite, ExportRotateClockwisify(nRotation), 
IsGroupShape( rXShape ));
 }
 
 void DrawingML::WriteRunProperties( const Reference< XPropertySet >& rRun, 
bool bIsField, sal_Int32 nElement, bool bCheckDirect,
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 05e5807995a2..46dc2ebfb07c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4775,7 +4775,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const 
SwGrfNode* pGrfNode, const Size
 if (sal_uInt32 nRot = rSet.Get(RES_GRFATR_ROTATION).GetValue())
 {
 // RES_GRFATR_ROTATION is in 10ths of degree; convert to 100ths 
for macro
-sal_uInt32 mOOXMLRot = 
OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(nRot*10);
+sal_uInt32 mOOXMLRot = 
oox::drawingml::ExportRotateClockwisify(nRot*10);
 xFrameAttributes->add(XML_rot, OString::number(mOOXMLRot));
 aSize = pGrfNode->GetTwipSize();
 }
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx 
b/sw/source/filter/ww8/docxsdrexport.cxx
index 55b159bbae70..6484fbef9883 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -1588,7 +1588,7 @@ void DocxSdrExport::writeDMLTextFrame(ww8::Frame const* 
pParentFrame, int nAncho
 }
 aRotation >>= m_pImpl->getDMLandVMLTextFrameRotation();
 OString sRotation(OString::number(
-
(OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(m_pImpl->getDMLandVMLTextFrameRotation();
+
oox::drawingml::ExportRotateClockwisify(m_pImpl->getDMLandVMLTextFrameRotation(;
 // Shape properties
 pFS->startElementNS(XML_wps, XML_spPr, FSEND);
 if (m_pImpl->getDMLandVMLTextFrameRotation())
commit 59886618cf8db7842ad4724a56f0f92436d0b3bd
Author: Miklos Vajna 
AuthorDate: Fri Feb 1 23:31:18 2019 +0100
Commit: Miklos Vajna 
CommitDate: Sat Feb 2 08:33:37 2019 +0100

tools: use std::swap() in Rectangle::Justify()

Change-Id: If613c9e54f8b6178937f085c594d16a9b883ac10
Reviewed-on: https://gerrit.libreoffice.org/67263
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/tools/source/generic/gen.cxx b/tools/source/generic/gen.cxx
index 16b81b6ee56f..3593801579ac 100644
--- a/tools/source/generic/gen.cxx
+++ b/tools/source/generic/gen.cxx
@@ -19,6 +19,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -145,20 +146,14 @@ tools::Rectangle& tools::Rectangle::Intersection( const 
tools::Rectangle& 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source

2018-02-25 Thread Tomaž Vajngerl
 include/oox/vml/vmlshape.hxx |5 -
 oox/source/export/shapes.cxx |2 +-
 oox/source/vml/vmlshape.cxx  |   40 +---
 3 files changed, 22 insertions(+), 25 deletions(-)

New commits:
commit 9932cbe1a515420acad07411606be425d31584aa
Author: Tomaž Vajngerl 
Date:   Wed Feb 21 20:30:51 2018 +0900

When exporting a shape, use "Graphic" property from images

We still used "GraphicURL" when exporting a shape, but as it is
being replaced, change that to use "Graphic" property instead.

Change-Id: Ia2b6bdacf0e28de6cfe2eaa36e5b558250ebee8e
Reviewed-on: https://gerrit.libreoffice.org/50142
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 8f374c0d54d1..b9a19bf506b4 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1864,7 +1864,7 @@ ShapeExport& ShapeExport::WriteTextShape( const 
Reference< XShape >& xShape )
 WriteShapeTransformation( xShape, XML_a );
 WritePresetShape( "rect" );
 uno::Reference xPropertySet(xShape, UNO_QUERY);
-WriteBlipOrNormalFill(xPropertySet, "GraphicURL");
+WriteBlipOrNormalFill(xPropertySet, "Graphic");
 WriteOutline(xPropertySet);
 pFS->endElementNS( mnXmlNamespace, XML_spPr );
 
commit cfc2715f1500d98671834254f2d8c4de19ff8507
Author: Tomaž Vajngerl 
Date:   Wed Feb 21 20:26:56 2018 +0900

Use "Graphic" instead of "GraphicURL" property for SimpleShape

We don't need to create an URL when we get the XGraphic from the
signatures, that use SimpleShape. We can just use the XGraphic
directly and set the "Graphic" property on creation of
SimpleShape.

Change-Id: I82b1f76cd358fca29f5b9dfbed0e735bd1f38e15
Reviewed-on: https://gerrit.libreoffice.org/50141
Tested-by: Jenkins 
Reviewed-by: Tomaž Vajngerl 

diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx
index 9b2683e95bea..55e7afedcb50 100644
--- a/include/oox/vml/vmlshape.hxx
+++ b/include/oox/vml/vmlshape.hxx
@@ -35,6 +35,7 @@ namespace com { namespace sun { namespace star {
 namespace awt { struct Rectangle; }
 namespace drawing { class XShape; }
 namespace drawing { class XShapes; }
+namespace graphic { class XGraphic; }
 } } }
 
 namespace oox {
@@ -304,9 +305,11 @@ protected:
 css::uno::ReferencecreateEmbeddedPictureObject(
 const css::uno::Reference< css::drawing::XShapes >& rxShapes,
 const css::awt::Rectangle& rShapeRect, OUString const & rGraphicPath ) 
const;
+
 css::uno::ReferencecreatePictureObject(
 const css::uno::Reference< css::drawing::XShapes >& rxShapes,
-const css::awt::Rectangle& rShapeRect, OUString const & 
rGraphicUrl ) const;
+const css::awt::Rectangle& rShapeRect,
+css::uno::Reference const & rxGraphic) 
const;
 
 private:
 OUString maService;  ///< Name of the UNO shape service.
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d3540a3033b1..e30091411cc4 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -863,21 +863,21 @@ Reference< XShape > SimpleShape::implConvertAndInsert( 
const Reference< XShapes
 
 Reference< XShape > SimpleShape::createEmbeddedPictureObject( const Reference< 
XShapes >& rxShapes, const awt::Rectangle& rShapeRect, OUString const & 
rGraphicPath ) const
 {
-XmlFilterBase& rFilter = mrDrawing.getFilter();
-OUString aGraphicUrl = 
rFilter.getGraphicHelper().importEmbeddedGraphicObject( rGraphicPath );
-return SimpleShape::createPictureObject(rxShapes, rShapeRect, aGraphicUrl);
+Reference xGraphic = 
mrDrawing.getFilter().getGraphicHelper().importEmbeddedGraphic(rGraphicPath);
+return SimpleShape::createPictureObject(rxShapes, rShapeRect, xGraphic);
 }
 
-Reference< XShape > SimpleShape::createPictureObject( const Reference< XShapes 
>& rxShapes, const awt::Rectangle& rShapeRect, OUString const & rGraphicUrl ) 
const
+Reference< XShape > SimpleShape::createPictureObject(const Reference< XShapes 
>& rxShapes,
+ const awt::Rectangle& 
rShapeRect,
+ 
uno::Reference const & rxGraphic) const
 {
 Reference< XShape > xShape = mrDrawing.createAndInsertXShape( 
"com.sun.star.drawing.GraphicObjectShape", rxShapes, rShapeRect );
 if( xShape.is() )
 {
-
-PropertySet aPropSet( xShape );
-if( !rGraphicUrl.isEmpty() )
+PropertySet aPropSet(xShape);
+if (rxGraphic.is())
 {
-aPropSet.setProperty( PROP_GraphicURL, rGraphicUrl );
+aPropSet.setProperty(PROP_Graphic, rxGraphic);
 }
 uno::Reference< lang::XServiceInfo > 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source writerfilter/source

2018-02-13 Thread Ashod Nakashian
 include/oox/core/xmlfilterbase.hxx  |5 
 oox/source/core/xmlfilterbase.cxx   |  202 
 writerfilter/source/filter/WriterFilter.cxx |   36 
 3 files changed, 209 insertions(+), 34 deletions(-)

New commits:
commit 335a2b80fa900848a8b60d8fd5db6656bc30a95a
Author: Ashod Nakashian 
Date:   Tue Feb 6 17:49:23 2018 -0500

oox: preserve custom oox fragments and packages

Change-Id: Ic4c75d136601a9b7d772aab577c9fbebc7391eaf
Reviewed-on: https://gerrit.libreoffice.org/49236
Tested-by: Jenkins 
Reviewed-by: Ashod Nakashian 

diff --git a/include/oox/core/xmlfilterbase.hxx 
b/include/oox/core/xmlfilterbase.hxx
index 7621a0081a53..51e6e496ea6a 100644
--- a/include/oox/core/xmlfilterbase.hxx
+++ b/include/oox/core/xmlfilterbase.hxx
@@ -259,6 +259,9 @@ private:
 virtual StorageRef  implCreateStorage(
 const css::uno::Reference< css::io::XStream >& 
rxOutStream ) const override;
 
+void importCustomFragments(css::uno::Reference& 
xDocumentStorage);
+void exportCustomFragments();
+
 private:
 ::std::unique_ptr< XmlFilterBaseImpl > mxImpl;
 sal_Int32 mnRelId;
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 15f253c734c7..d97aeab59a89 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -29,6 +29,9 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -48,6 +51,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -57,6 +61,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -64,6 +69,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using ::com::sun::star::xml::dom::DocumentBuilder;
 using ::com::sun::star::xml::dom::XDocument;
@@ -282,6 +288,8 @@ void XmlFilterBase::importDocumentProperties()
 Reference< XDocumentProperties > xDocProps = 
xPropSupplier->getDocumentProperties();
 xImporter->importProperties( xDocumentStorage, xDocProps );
 checkDocumentProperties(xDocProps);
+
+importCustomFragments(xDocumentStorage);
 }
 
 FastParser* XmlFilterBase::createParser()
@@ -833,6 +841,8 @@ void XmlFilterBase::exportDocumentProperties( const 
Reference< XDocumentProperti
 writeAppProperties( *this, xProperties );
 writeCustomProperties( *this, xProperties );
 }
+
+exportCustomFragments();
 }
 
 // protected --
@@ -946,6 +956,168 @@ OUString XmlFilterBase::getNamespaceURL(sal_Int32 nNSID) 
const
 return itr->second;
 }
 
+void 
XmlFilterBase::importCustomFragments(css::uno::Reference& 
xDocumentStorage)
+{
+Reference xRelations(xDocumentStorage, UNO_QUERY);
+if (xRelations.is())
+{
+// These are all the custom types we recognize and can preserve.
+static const std::set sCustomTypes = {
+
"http://schemas.dell.com/ddp/2016/relationships/xenFile;,
+
"http://schemas.dell.com/ddp/2016/relationships/hmacFile;,
+
"http://schemas.dell.com/ddp/2016/relationships/metadataFile;
+};
+
+uno::Sequence aSeqs = 
xRelations->getAllRelationships();
+
+std::vector aCustomFragments;
+std::vector aCustomFragmentTypes;
+std::vector aCustomFragmentTargets;
+for (sal_Int32 j = 0; j < aSeqs.getLength(); j++)
+{
+OUString sType;
+OUString sTarget;
+const uno::Sequence& aSeq = aSeqs[j];
+for (sal_Int32 i = 0; i < aSeq.getLength(); i++)
+{
+const beans::StringPair& aPair = aSeq[i];
+if (aPair.First == "Target")
+sTarget = aPair.Second;
+else if (aPair.First == "Type")
+sType = aPair.Second;
+}
+
+if (sCustomTypes.find(sType) != sCustomTypes.end())
+{
+StreamDataSequence aDataSeq;
+if (importBinaryData(aDataSeq, sTarget))
+{
+aCustomFragments.emplace_back(aDataSeq);
+aCustomFragmentTypes.emplace_back(sType);
+aCustomFragmentTargets.emplace_back(sTarget);
+}
+}
+}
+
+// Adding the saved custom xml DOM
+comphelper::SequenceAsHashMap aGrabBagProperties;
+aGrabBagProperties["OOXCustomFragments"] <<= 
comphelper::containerToSequence(aCustomFragments);
+aGrabBagProperties["OOXCustomFragmentTypes"] <<= 
comphelper::containerToSequence(aCustomFragmentTypes);
+aGrabBagProperties["OOXCustomFragmentTargets"] <<= 
comphelper::containerToSequence(aCustomFragmentTargets);
+
+std::vector aCustomXmlDomList;
+ 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sc/source sw/CppunitTest_sw_ooxmlimport.mk sw/qa writerfilter/source

2017-08-09 Thread Tamás Zolnai
 include/oox/vml/vmldrawing.hxx  |5 +++
 include/oox/vml/vmlshapecontext.hxx |9 ++
 oox/source/core/fragmenthandler2.cxx|1 
 oox/source/ppt/slidefragmenthandler.cxx |1 
 oox/source/vml/vmldrawing.cxx   |   11 ++-
 oox/source/vml/vmldrawingfragment.cxx   |3 +-
 oox/source/vml/vmlshape.cxx |   13 +---
 oox/source/vml/vmlshapecontext.cxx  |   18 +++-
 sc/source/filter/oox/worksheetfragment.cxx  |2 +
 sw/CppunitTest_sw_ooxmlimport.mk|3 +-
 sw/qa/extras/ooxmlimport/data/activex_checkbox.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   29 
 writerfilter/source/ooxml/model.xml |   24 
 13 files changed, 85 insertions(+), 34 deletions(-)

New commits:
commit 4a764319cbad4e2589cc105145ac27defbf49ff6
Author: Tamás Zolnai 
Date:   Wed Aug 9 16:06:17 2017 +0200

tdf#91384: DOCX: import ActiveX controls

Change-Id: Iebf2ff65fcec3231acfc962fb2f1abc2ed2dc67a
Reviewed-on: https://gerrit.libreoffice.org/40930
Tested-by: Jenkins 
Reviewed-by: Tamás Zolnai 

diff --git a/include/oox/vml/vmldrawing.hxx b/include/oox/vml/vmldrawing.hxx
index e9309f6c8497..e75fd480b82f 100644
--- a/include/oox/vml/vmldrawing.hxx
+++ b/include/oox/vml/vmldrawing.hxx
@@ -81,6 +81,7 @@ struct OOX_DLLPUBLIC ControlInfo
 OUString maShapeId;  ///< Shape identifier for shape lookup.
 OUString maFragmentPath; ///< Path to the fragment describing the 
form control properties.
 OUString maName; ///< Programmatical name of the form 
control.
+bool mbTextContentShape; ///< Whether this control shape will be 
imported to Writer or not (has AnchorType poperty or not).
 
 explicitControlInfo();
 
diff --git a/include/oox/vml/vmlshapecontext.hxx 
b/include/oox/vml/vmlshapecontext.hxx
index fe7afb417b52..f73055b3355f 100644
--- a/include/oox/vml/vmlshapecontext.hxx
+++ b/include/oox/vml/vmlshapecontext.hxx
@@ -178,6 +178,15 @@ public:
 onCreateContext( sal_Int32 nElement, const 
AttributeList& rAttribs ) override;
 };
 
+class ControlShapeContext : public ShapeContextBase
+{
+public:
+explicitControlShapeContext(
+::oox::core::ContextHandler2Helper const & rParent,
+ShapeContainer& rShapes,
+const AttributeList& rAttribs );
+};
+
 
 } // namespace vml
 } // namespace oox
diff --git a/oox/source/vml/vmldrawing.cxx b/oox/source/vml/vmldrawing.cxx
index 85d6febc73c5..a222af59443c 100644
--- a/oox/source/vml/vmldrawing.cxx
+++ b/oox/source/vml/vmldrawing.cxx
@@ -79,6 +79,7 @@ void OleObjectInfo::setShapeId( sal_Int32 nShapeId )
 }
 
 ControlInfo::ControlInfo()
+: mbTextContentShape(false)
 {
 }
 
diff --git a/oox/source/vml/vmldrawingfragment.cxx 
b/oox/source/vml/vmldrawingfragment.cxx
index c1bed09b73fd..5f7c91f24934 100644
--- a/oox/source/vml/vmldrawingfragment.cxx
+++ b/oox/source/vml/vmldrawingfragment.cxx
@@ -51,7 +51,8 @@ ContextHandlerRef DrawingFragment::onCreateContext( sal_Int32 
nElement, const At
 {
 // DOCX filter handles plain shape elements with this fragment handler
 case VMLDRAWING_WORD:
-if ( getNamespace( nElement ) == NMSP_vml )
+if ( getNamespace( nElement ) == NMSP_vml
+ || nElement == W_TOKEN(control) ) // Control shape also 
defined as a vml shape
 return ShapeContextBase::createShapeContext( *this, 
mrDrawing.getShapes(), nElement, rAttribs );
 break;
 
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 2d03cb7e38e0..b51a9020393f 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1185,18 +1185,21 @@ Reference< XShape > ComplexShape::implConvertAndInsert( 
const Reference< XShapes
 const ControlInfo* pControlInfo = mrDrawing.getControlInfo( 
maTypeModel.maShapeId );
 if( pControlInfo && !pControlInfo->maFragmentPath.isEmpty() )
 {
-OSL_ENSURE( nShapeType == VML_SHAPETYPE_HOSTCONTROL, 
"ComplexShape::implConvertAndInsert - unexpected shape type" );
-OUString aShapeName = getShapeName();
-if( !aShapeName.isEmpty() )
+if( !pControlInfo->maName.isEmpty() )
 {
-OSL_ENSURE( aShapeName == pControlInfo->maName, 
"ComplexShape::implConvertAndInsert - control name mismatch" );
 // load the control properties from fragment
-::oox::ole::EmbeddedControl aControl( aShapeName );
+::oox::ole::EmbeddedControl aControl(pControlInfo->maName);
 if( rFilter.importFragment( new ::oox::ole::AxControlFragment( 
rFilter, 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/source

2017-04-05 Thread Caolán McNamara
 include/oox/core/fastparser.hxx   |2 ++
 oox/source/core/fastparser.cxx|7 +++
 oox/source/core/xmlfilterbase.cxx |2 +-
 sw/source/filter/ww8/ww8graf.cxx  |3 ++-
 4 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit a32ef811014a9ae10e8d996e61cff39b3c99028d
Author: Caolán McNamara 
Date:   Wed Apr 5 10:36:06 2017 +0100

ofz: infinite loop and oom

Change-Id: Ibb23b5808ae465294adf2342d5535784476f5395

diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 8967f5b0d04e..a6b659775660 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -1336,7 +1336,8 @@ SdrObject* SwWW8ImplReader::ReadGrafPrimitive(short& 
rLeft, SfxAllItemSet )
 // into an object hierarchy with a little effort.
 SdrObject *pRet=nullptr;
 WW8_DPHEAD aHd; // Lese Draw-Primitive-Header
-bool bCouldRead = checkRead(*m_pStrm, , sizeof(WW8_DPHEAD));
+bool bCouldRead = checkRead(*m_pStrm, , sizeof(WW8_DPHEAD)) &&
+  SVBT16ToShort(aHd.cb) >= sizeof(WW8_DPHEAD);
 OSL_ENSURE(bCouldRead, "Graphic Primitive header short read" );
 if (!bCouldRead)
 {
commit 58b56f8c78eef15c70e1afd6b52c79a800a185ab
Author: Caolán McNamara 
Date:   Wed Apr 5 10:00:13 2017 +0100

add a clearDocumentHandler for null document handler case

Change-Id: I661a2fd5381013056c69b379792560aed7121214

diff --git a/include/oox/core/fastparser.hxx b/include/oox/core/fastparser.hxx
index 6af112d18d93..b2a9bab30ab6 100644
--- a/include/oox/core/fastparser.hxx
+++ b/include/oox/core/fastparser.hxx
@@ -78,6 +78,8 @@ public:
 voidsetDocumentHandler(
 const css::uno::Reference< 
css::xml::sax::XFastDocumentHandler >& rxDocHandler );
 
+voidclearDocumentHandler();
+
 /** Parses the passed SAX input source.
 @param bCloseStream  True = closes the stream in the input source 
after parsing.
 @throws css::xml::sax::SAXException
diff --git a/oox/source/core/fastparser.cxx b/oox/source/core/fastparser.cxx
index 4ce9d9f37cf7..d31ee7067f1c 100644
--- a/oox/source/core/fastparser.cxx
+++ b/oox/source/core/fastparser.cxx
@@ -107,6 +107,13 @@ void FastParser::setDocumentHandler( const Reference< 
XFastDocumentHandler >& rx
 mxParser->setFastDocumentHandler( rxDocHandler );
 }
 
+void FastParser::clearDocumentHandler()
+{
+if (!mxParser.is())
+return;
+mxParser->setFastDocumentHandler(nullptr);
+}
+
 void FastParser::parseStream( const InputSource& rInputSource, bool 
bCloseStream )
 {
 // guard closing the input stream also when exceptions are thrown
diff --git a/oox/source/core/xmlfilterbase.cxx 
b/oox/source/core/xmlfilterbase.cxx
index 393911c97699..8401dd7ce59d 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -211,7 +211,7 @@ XmlFilterBase::~XmlFilterBase()
 // the following implicit destruction chain of ~XmlFilterBaseImpl, but in 
that
 // case it's member RelationsMap maRelationsMap will be destroyed, but 
maybe
 // still be used by ~FragmentHandler -> crash.
-mxImpl->maFastParser.setDocumentHandler( nullptr );
+mxImpl->maFastParser.clearDocumentHandler();
 }
 
 void XmlFilterBase::checkDocumentProperties(const 
Reference& xDocProps)
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - include/oox oox/source

2016-10-17 Thread Jochen Nitschke
 include/oox/helper/propertymap.hxx   |3 ++
 oox/source/drawingml/customshapeproperties.cxx   |2 -
 oox/source/drawingml/shape.cxx   |   12 +-
 oox/source/drawingml/textparagraphproperties.cxx |   26 +++
 oox/source/vml/vmlformatting.cxx |2 -
 oox/source/vml/vmlshape.cxx  |2 -
 6 files changed, 25 insertions(+), 22 deletions(-)

New commits:
commit a8cfb651ac0d2669d5780b707bfb1efb43f0f34c
Author: Jochen Nitschke 
Date:   Sun Oct 16 19:09:01 2016 +0200

delete setProperty specialisation with value type Any

Using delete instead of std::enable_if
because of better error message.

Change-Id: I92c57a4bb3281b119166a8f98a94ed3aa6079df5
Reviewed-on: https://gerrit.libreoffice.org/29930
Tested-by: Jenkins 
Reviewed-by: Jochen Nitschke 

diff --git a/include/oox/helper/propertymap.hxx 
b/include/oox/helper/propertymap.hxx
index cf9b802..badcf0d 100644
--- a/include/oox/helper/propertymap.hxx
+++ b/include/oox/helper/propertymap.hxx
@@ -76,6 +76,9 @@ public:
 return true;
 }
 
+/** setAnyProperty should be used */
+boolsetProperty( sal_Int32, const css::uno::Any& ) = 
delete;
+
 css::uno::Any   getProperty( sal_Int32 nPropId );
 
 voiderase( sal_Int32 nPropId );
commit d9e335ea6f7c99932fdc822c3b87321201389634
Author: Jochen Nitschke 
Date:   Sun Oct 16 12:29:31 2016 +0200

fix wrong usages of setProperty vs setAnyProperty...

and remove some useless casts.

setAnyProperty takes an Any for property value.
setProperty takes any value and creates an Any.

Change-Id: Ida0a80bd679775c08925309bfbc695630af2225f
Reviewed-on: https://gerrit.libreoffice.org/29917
Tested-by: Jenkins 
Reviewed-by: Jochen Nitschke 

diff --git a/oox/source/drawingml/customshapeproperties.cxx 
b/oox/source/drawingml/customshapeproperties.cxx
index daf178d..3ef04b4 100644
--- a/oox/source/drawingml/customshapeproperties.cxx
+++ b/oox/source/drawingml/customshapeproperties.cxx
@@ -174,7 +174,7 @@ void CustomShapeProperties::pushToPropSet( const 
::oox::core::FilterBase& /* rFi
 OUString presetTextWarp;
 if ( aGeoPropSeq[ i ].Value >>= presetTextWarp )
 {
-aPropertyMap.setProperty( PROP_PresetTextWarp, Any( 
presetTextWarp ) );
+aPropertyMap.setProperty( PROP_PresetTextWarp, 
presetTextWarp );
 }
 }
 }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 83a02d4..1befb50 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -805,19 +805,19 @@ Reference< XShape > const & Shape::createAndInsert(
 // TextFrames have BackColor, not FillColor
 if (aShapeProps.hasProperty(PROP_FillColor))
 {
-aShapeProps.setProperty(PROP_BackColor, 
aShapeProps.getProperty(PROP_FillColor));
+aShapeProps.setAnyProperty(PROP_BackColor, 
aShapeProps.getProperty(PROP_FillColor));
 aShapeProps.erase(PROP_FillColor);
 }
 // TextFrames have BackColorTransparency, not FillTransparence
 if (aShapeProps.hasProperty(PROP_FillTransparence))
 {
-aShapeProps.setProperty(PROP_BackColorTransparency, 
aShapeProps.getProperty(PROP_FillTransparence));
+aShapeProps.setAnyProperty(PROP_BackColorTransparency, 
aShapeProps.getProperty(PROP_FillTransparence));
 aShapeProps.erase(PROP_FillTransparence);
 }
 // TextFrames have BackGrahicURL, not FillBitmapURL
 if (aShapeProps.hasProperty(PROP_FillBitmapURL))
 {
-aShapeProps.setProperty(PROP_BackGraphicURL, 
aShapeProps.getProperty(PROP_FillBitmapURL));
+aShapeProps.setAnyProperty(PROP_BackGraphicURL, 
aShapeProps.getProperty(PROP_FillBitmapURL));
 aShapeProps.erase(PROP_FillBitmapURL);
 }
 if (aShapeProps.hasProperty(PROP_FillBitmapName))
@@ -840,7 +840,7 @@ Reference< XShape > const & Shape::createAndInsert(
 aBorderLine.Color = 
aShapeProps.getProperty(PROP_LineColor).get();
 if (aLineProperties.moLineWidth.has())
 aBorderLine.LineWidth = 
convertEmuToHmm(aLineProperties.moLineWidth.get());
-aShapeProps.setProperty(nBorder, 
uno::makeAny(aBorderLine));
+aShapeProps.setProperty(nBorder, aBorderLine);
 }
 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa

2016-01-15 Thread Michael Stahl
 include/oox/export/shapes.hxx |1 
 oox/source/export/shapes.cxx  |   90 +-
 sd/qa/unit/export-tests.cxx   |   28 +
 3 files changed, 109 insertions(+), 10 deletions(-)

New commits:
commit a951d70609fa125def231c3d7579e72c381334f5
Author: Michael Stahl 
Date:   Mon Jan 11 17:16:24 2016 +0100

oox: getEntryName() could throw a WrongStateException

let's guard against that.

Change-Id: I970fb801a642592d9c23390572867f0e21f03132

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 0facbf1..b4e7b13 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1678,15 +1678,24 @@ ShapeExport& ShapeExport::WriteOLE2Shape( Reference< 
XShape > xShape )
 return *this;
 }
 
-uno::Reference const xParent(
-uno::Reference(xObj, uno::UNO_QUERY)->getParent(),
-uno::UNO_QUERY);
-
 uno::Sequence grabBag;
-xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
+OUString entryName;
+try
+{
+uno::Reference const xParent(
+uno::Reference(xObj, 
uno::UNO_QUERY_THROW)->getParent(),
+uno::UNO_QUERY_THROW);
+
+xParent->getPropertyValue("InteropGrabBag") >>= grabBag;
+
+entryName = uno::Reference(xObj, 
uno::UNO_QUERY)->getEntryName();
+}
+catch (uno::Exception const& e)
+{
+SAL_WARN("oox", "ShapeExport::WriteOLE2Shape: exception: " << 
e.Message);
+return *this;
+}
 
-OUString const entryName(
-uno::Reference(xObj, 
uno::UNO_QUERY)->getEntryName());
 OUString progID;
 
 for (auto const& it : grabBag)
commit cb890ae43bacd2be24bc74fad2e2e5cce8910995
Author: Michael Stahl 
Date:   Fri Jan 15 15:26:43 2016 +0100

oox: export Math objects to PPTX files

These hit the assert in lcl_StoreOwnAsOOXML now so better implement some
export.

Change-Id: I10c005a547e8a85f2a82198a49f9a03fc46a61d7

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 29f597f..ab67def 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -180,6 +180,7 @@ public:
 WriteTextShape( css::uno::Reference< 
css::drawing::XShape > xShape );
 ShapeExport&
 WriteTableShape( css::uno::Reference< 
css::drawing::XShape > xShape );
+void
WriteMathShape(css::uno::Reference const& xShape);
 ShapeExport&
 WriteOLE2Shape( css::uno::Reference< 
css::drawing::XShape > xShape );
 virtual ShapeExport&
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 8320aad..0facbf1 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -93,6 +93,7 @@
 #include 
 #include 
 #include 
+#include 
 
 using namespace ::css;
 using namespace ::css::beans;
@@ -1578,13 +1579,64 @@ ShapeExport& ShapeExport::WriteTextShape( Reference< 
XShape > xShape )
 return *this;
 }
 
+void ShapeExport::WriteMathShape(Reference const& xShape)
+{
+Reference const xPropSet(xShape, UNO_QUERY);
+assert(xPropSet.is());
+Reference xMathModel;
+xPropSet->getPropertyValue("Model") >>= xMathModel;
+assert(xMathModel.is());
+assert(GetDocumentType() != DOCUMENT_DOCX); // should be written in 
DocxAttributeOutput
+SAL_WARN_IF(GetDocumentType() == DOCUMENT_XLSX, "oox", "Math export to 
XLSX isn't tested, should it happen here?");
+
+// ECMA standard does not actually allow oMath outside of
+// WordProcessingML so write a MCE like PPT 2010 does
+mpFS->startElementNS(XML_mc, XML_AlternateContent, FSEND);
+mpFS->startElementNS(XML_mc, XML_Choice,
+FSNS(XML_xmlns, XML_a14), 
"http://schemas.microsoft.com/office/drawing/2010/main;,
+XML_Requires, "a14",
+FSEND);
+mpFS->startElementNS(mnXmlNamespace, XML_sp, FSEND);
+mpFS->startElementNS(mnXmlNamespace, XML_nvSpPr, FSEND);
+mpFS->singleElementNS(mnXmlNamespace, XML_cNvPr,
+ XML_id, OString::number(GetNewShapeID(xShape)).getStr(),
+ XML_name, OString("Formula " + 
OString::number(mnShapeIdMax++)).getStr(),
+ FSEND);
+mpFS->singleElementNS(mnXmlNamespace, XML_cNvSpPr, XML_txBox, "1", FSEND);
+mpFS->singleElementNS(mnXmlNamespace, XML_nvPr, FSEND);
+mpFS->endElementNS(mnXmlNamespace, XML_nvSpPr);
+mpFS->startElementNS(mnXmlNamespace, XML_spPr, FSEND);
+WriteShapeTransformation(xShape, XML_a);
+WritePresetShape("rect");
+mpFS->endElementNS(mnXmlNamespace, XML_spPr);
+mpFS->startElementNS(mnXmlNamespace, XML_txBody, FSEND);
+mpFS->startElementNS(XML_a, XML_bodyPr, FSEND);
+mpFS->endElementNS(XML_a, XML_bodyPr);
+mpFS->startElementNS(XML_a, XML_p, FSEND);
+mpFS->startElementNS(XML_a14, XML_m, FSEND);
+
+oox::FormulaExportBase *const 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sc/source

2015-04-15 Thread Markus Mohrhard
 include/oox/drawingml/clrscheme.hxx   |8 +++---
 oox/source/drawingml/clrscheme.cxx|   37 +++---
 sc/source/filter/inc/themebuffer.hxx  |2 +
 sc/source/filter/oox/condformatbuffer.cxx |2 -
 sc/source/filter/oox/themebuffer.cxx  |6 
 5 files changed, 42 insertions(+), 13 deletions(-)

New commits:
commit f3121049828596b369e3ea844355d61666e49795
Author: Markus Mohrhard markus.mohrh...@googlemail.com
Date:   Wed Apr 15 18:19:47 2015 +0200

use index as real index and not token, tdf#90511

At least in calc a theme index is a zero based index into the clrScheme.
A map is unsiutable for that task so let us use a vector and still allow
to get them by their tokens.

Change-Id: I09d56acaf22c3ed16387aae95c36382302c5a17e

diff --git a/include/oox/drawingml/clrscheme.hxx 
b/include/oox/drawingml/clrscheme.hxx
index b4c12cf..00bf149 100644
--- a/include/oox/drawingml/clrscheme.hxx
+++ b/include/oox/drawingml/clrscheme.hxx
@@ -42,12 +42,15 @@ typedef std::shared_ptr ClrMap  ClrMapPtr;
 
 class OOX_DLLPUBLIC ClrScheme
 {
-std::map  sal_Int32, sal_Int32  maClrScheme;
+std::vector std::pairsal_Int32, sal_Int32  maClrScheme;
 
 public:
 
 bool getColor( sal_Int32 nSchemeClrToken, sal_Int32 rColor ) const;
 void setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor );
+
+bool getColorByIndex(size_t nIndex,
+sal_Int32 rColor) const;
 };
 
 typedef std::shared_ptr ClrScheme  ClrSchemePtr;
diff --git a/oox/source/drawingml/clrscheme.cxx 
b/oox/source/drawingml/clrscheme.cxx
index 52f78aa..9fb8382 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -43,6 +43,21 @@ void ClrMap::setColorMap( sal_Int32 nClrToken, sal_Int32 
nMappedClrToken )
 maClrMap[ nClrToken ] = nMappedClrToken;
 }
 
+struct find_by_token
+{
+find_by_token(sal_Int32 token):
+m_token(token)
+{
+}
+
+bool operator()(const std::pairsal_Int32, sal_Int32 r)
+{
+return r.first == m_token;
+}
+
+private:
+sal_Int32 m_token;
+};
 
 bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32 rColor ) const
 {
@@ -54,15 +69,27 @@ bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, 
sal_Int32 rColor ) const
 case XML_tx1 : nSchemeClrToken = XML_dk1; break;
 case XML_tx2 : nSchemeClrToken = XML_dk2; break;
 }
-std::map  sal_Int32, sal_Int32 ::const_iterator aIter( maClrScheme.find( 
nSchemeClrToken ) );
+
+auto aIter = std::find_if(maClrScheme.begin(), maClrScheme.end(), 
find_by_token(nSchemeClrToken) );
+
 if ( aIter != maClrScheme.end() )
-rColor = (*aIter).second;
+rColor = aIter-second;
+
 return aIter != maClrScheme.end();
 }
 
 void ClrScheme::setColor( sal_Int32 nSchemeClrToken, sal_Int32 nColor )
 {
-maClrScheme[ nSchemeClrToken ] = nColor;
+maClrScheme.push_back(std::pairsal_Int32, sal_Int32(nSchemeClrToken, 
nColor));
+}
+
+bool ClrScheme::getColorByIndex(size_t nIndex, sal_Int32 rColor) const
+{
+if (nIndex = maClrScheme.size())
+return false;
+
+rColor = maClrScheme[nIndex].second;
+return true;
 }
 
 } }
diff --git a/sc/source/filter/inc/themebuffer.hxx 
b/sc/source/filter/inc/themebuffer.hxx
index 84ff9ea..21f560a 100644
--- a/sc/source/filter/inc/themebuffer.hxx
+++ b/sc/source/filter/inc/themebuffer.hxx
@@ -37,6 +37,8 @@ public:
 /** Returns the theme color with the specified token identifier. */
 sal_Int32   getColorByToken( sal_Int32 nToken ) const;
 
+sal_Int32   getColorByIndex(size_t nIndex) const;
+
 /** Returns the default font data for the current file type. */
 inline const FontModel getDefaultFontModel() const { return 
*mxDefFontModel; }
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx 
b/sc/source/filter/oox/condformatbuffer.cxx
index 2c04142..cfe4af2 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -245,7 +245,7 @@ void DataBarRule::importColor( const AttributeList 
rAttribs )
 else if( rAttribs.hasAttribute( XML_theme ) )
 {
 sal_uInt32 nThemeIndex = rAttribs.getUnsigned( XML_theme, 0 );
-nColor = getTheme().getColorByToken( nThemeIndex );
+nColor = getTheme().getColorByIndex( nThemeIndex );
 }
 
 ::Color aColor = RgbToRgbComponents( nColor );
diff --git a/sc/source/filter/oox/themebuffer.cxx 
b/sc/source/filter/oox/themebuffer.cxx
index 58ed242..a4dfc32 100644
--- a/sc/source/filter/oox/themebuffer.cxx
+++ b/sc/source/filter/oox/themebuffer.cxx
@@ -56,6 +56,12 @@ sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) 
const
 return getClrScheme().getColor( nToken, nColor ) ? nColor : 
API_RGB_TRANSPARENT;
 }
 
+sal_Int32 ThemeBuffer::getColorByIndex(size_t nIndex) const
+{
+sal_Int32 nColor = 0;
+return getClrScheme().getColorByIndex(nIndex, nColor) ? nColor : 
API_RGB_TRANSPARENT;

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source svx/source sw/source

2014-06-16 Thread Miklos Vajna
 include/oox/export/vmlexport.hxx |2 
 oox/source/export/vmlexport.cxx  |   37 +
 svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx |3 
 sw/source/filter/ww8/docxattributeoutput.cxx |8 ++
 sw/source/filter/ww8/docxattributeoutput.hxx |1 
 sw/source/filter/ww8/docxsdrexport.cxx   |   58 ---
 sw/source/filter/ww8/docxsdrexport.hxx   |2 
 7 files changed, 81 insertions(+), 30 deletions(-)

New commits:
commit 6b5c0a5cb25fc0c7c673a9332c8d30b6efbb819b
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Mon Jun 16 19:38:38 2014 +0200

VML export: handle textbox text

Previously, we always exported the text of the shape itself. Bring the
VML export in sync with the drawingML export, where we only do that if
the shape doesn't have an associated textbox -- if that's the case, then
export the textbox's text instead.

CppunitTest_sw_ooxmlsdrexport's testFdo69636 is a reproducer for this
problem, the VML assert failed because of the lack of this.

Change-Id: Icb236579da4e3b74e983a95aa5675fed7862d1e1

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 3a7049e..a87ed16 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -37,6 +37,8 @@ class OOX_DLLPUBLIC VMLTextExport
 public:
 virtual void WriteOutliner(const OutlinerParaObject rParaObj) = 0;
 virtual oox::drawingml::DrawingML GetDrawingML() = 0;
+/// Write the contents of the textbox that is associated to this shape in 
VML format.
+virtual void WriteVMLTextBox(css::uno::Referencecss::drawing::XShape 
xShape) = 0;
 protected:
 VMLTextExport() {}
 virtual ~VMLTextExport() {}
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index f315766..b0d712e 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -27,11 +27,13 @@
 #include rtl/ustring.hxx
 
 #include tools/stream.hxx
+#include comphelper/sequenceashashmap.hxx
 #include svx/svdotext.hxx
 #include vcl/cvtgrf.hxx
 #include filter/msfilter/msdffimp.hxx
 #include filter/msfilter/escherex.hxx
 
+#include com/sun/star/drawing/XShape.hpp
 #include com/sun/star/text/HoriOrientation.hpp
 #include com/sun/star/text/VertOrientation.hpp
 #include com/sun/star/text/RelOrientation.hpp
@@ -958,6 +960,17 @@ std::vectorOString lcl_getShapeTypes()
 return aRet;
 }
 
+bool lcl_isTextBox(const SdrObject* pSdrObject)
+{
+uno::Referencebeans::XPropertySet 
xPropertySet(const_castSdrObject*(pSdrObject)-getUnoShape(), uno::UNO_QUERY);
+if (xPropertySet.is())
+{
+uno::Referencebeans::XPropertySetInfo xPropertySetInfo = 
xPropertySet-getPropertySetInfo();
+return xPropertySetInfo-hasPropertyByName(TextBox)  
xPropertySet-getPropertyValue(TextBox).getbool();
+}
+return false;
+}
+
 sal_Int32 VMLExport::StartShape()
 {
 if ( m_nShapeType == ESCHER_ShpInst_Nil )
@@ -1092,9 +1105,9 @@ sal_Int32 VMLExport::StartShape()
 m_pSerializer-startElementNS( XML_v, nShapeElement, 
XFastAttributeListRef( m_pShapeAttrList ) );
 }
 
-// now check if we have some text and we have a text exporter registered
+// now check if we have some editeng text (not associated textbox) and we 
have a text exporter registered
 const SdrTextObj* pTxtObj = PTR_CAST(SdrTextObj, m_pSdrObject);
-if (pTxtObj  m_pTextExport  m_nShapeType != 
ESCHER_ShpInst_TextPlainText)
+if (pTxtObj  m_pTextExport  m_nShapeType != 
ESCHER_ShpInst_TextPlainText  !IsWaterMarkShape(m_pSdrObject-GetName())  
!lcl_isTextBox(m_pSdrObject))
 {
 const OutlinerParaObject* pParaObj = 0;
 bool bOwnParaObj = false;
@@ -1132,6 +1145,26 @@ void VMLExport::EndShape( sal_Int32 nShapeElement )
 {
 if ( nShapeElement = 0 )
 {
+if (m_pTextExport  lcl_isTextBox(m_pSdrObject))
+{
+uno::Referencebeans::XPropertySet 
xPropertySet(const_castSdrObject*(m_pSdrObject)-getUnoShape(), 
uno::UNO_QUERY);
+comphelper::SequenceAsHashMap 
aCustomShapeProperties(xPropertySet-getPropertyValue(CustomShapeGeometry));
+sax_fastparser::FastAttributeList* pTextboxAttrList = 
m_pSerializer-createAttrList();
+if (aCustomShapeProperties.find(TextPreRotateAngle) != 
aCustomShapeProperties.end())
+{
+sal_Int32 nTextRotateAngle = 
aCustomShapeProperties[TextPreRotateAngle].getsal_Int32();
+if (nTextRotateAngle == -270)
+pTextboxAttrList-add(XML_style, 
mso-layout-flow-alt:bottom-to-top);
+}
+sax_fastparser::XFastAttributeListRef 
xTextboxAttrList(pTextboxAttrList);
+pTextboxAttrList = 0;
+m_pSerializer-startElementNS(XML_v, XML_textbox, 
xTextboxAttrList);
+
+

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa

2014-06-06 Thread Zolnai Tamás
 include/oox/drawingml/shape.hxx |4 
 include/oox/drawingml/textliststyle.hxx |3 
 include/oox/ppt/pptshapegroupcontext.hxx|3 
 oox/source/drawingml/diagram/diagram.cxx|   39 ++--
 oox/source/drawingml/diagram/diagramfragmenthandler.cxx |   49 ++---
 oox/source/drawingml/textliststyle.cxx  |   28 +++
 oox/source/ppt/pptshapegroupcontext.cxx |   13 +
 sd/qa/unit/data/pptx/bnc870233_1.pptx   |binary
 sd/qa/unit/data/pptx/bnc870233_2.pptx   |binary
 sd/qa/unit/import-tests.cxx |  141 
 10 files changed, 239 insertions(+), 41 deletions(-)

New commits:
commit 639571d52b1b7e4cf912803642ca245c5dd86839
Author: Zolnai Tamás tamas.zol...@collabora.com
Date:   Fri Jun 6 10:16:39 2014 +0200

2nd part of bnc#870233: import font color from color fragment for SmartArts

SmartArt import ignores some fragments during import if
drawing fragment exists, which seems to be not complete.
In this case font style is blank (white) in data (and drawing)
fragment and the real value is defined in the ignored color fragment.

So first make color fragment parsing work, then apply font
color of node0 style on nodes of the SmartArt.

Actually, it's a workaround, because node0 style label
is hardcoded, for a proper solution layout fragment should
be parsed too to get the right style label, but
it interferes with the drawing fragment by now.

Change-Id: I7db89176a07eee928563d42d3896fbd02190dfa8

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index fcb4999..f8e1b7c 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -176,6 +176,9 @@ public:
 const ::std::vectorOUString
 getExtDrawings() { return maExtDrawings; }
 voidaddExtDrawingRelId( const OUString rRelId ) { 
maExtDrawings.push_back( rRelId ); }
+// Set font color only for extdrawings.
+voidsetFontRefColorForNodes(const Color rColor) { 
maFontRefColorForNodes = rColor; }
+const ColorgetFontRefColorForNodes() const { return 
maFontRefColorForNodes; }
 voidsetLockedCanvas(bool bLockedCanvas);
 boolgetLockedCanvas();
 voidsetWps(bool bWps);
@@ -267,6 +270,7 @@ protected:
 com::sun::star::awt::Size   maSize;
 com::sun::star::awt::Point  maPosition;
 ::std::vectorOUStringmaExtDrawings;
+Color   maFontRefColorForNodes;
 
 private:
 enum FrameType
diff --git a/include/oox/ppt/pptshapegroupcontext.hxx 
b/include/oox/ppt/pptshapegroupcontext.hxx
index f4e1d7a..847d9b6 100644
--- a/include/oox/ppt/pptshapegroupcontext.hxx
+++ b/include/oox/ppt/pptshapegroupcontext.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_OOX_PPT_PPTSHAPEGROUPCONTEXT_HXX
 
 #include oox/drawingml/shapegroupcontext.hxx
+#include oox/drawingml/color.hxx
 #include oox/ppt/slidepersist.hxx
 
 namespace oox { namespace ppt {
@@ -30,7 +31,9 @@ class PPTShapeGroupContext : public 
::oox::drawingml::ShapeGroupContext
 SlidePersistPtr mpSlidePersistPtr;
 ShapeLocation   meShapeLocation;
 oox::drawingml::ShapePtrpGraphicShape;
+
 voidimportExtDrawings();
+voidapplyFontRefColor(oox::drawingml::ShapePtr pShape, 
const oox::drawingml::Color rFontRefColor);
 
 public:
 PPTShapeGroupContext(
diff --git a/oox/source/drawingml/diagram/diagram.cxx 
b/oox/source/drawingml/diagram/diagram.cxx
index 70d938a..a4ad279 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -320,7 +320,6 @@ void Diagram::build(  )
 #endif
 }
 
-
 void Diagram::addTo( const ShapePtr  pParentShape )
 {
 // collect data, init maps
@@ -432,7 +431,7 @@ void loadDiagram( ShapePtr pShape,
 }
 
 // extLst is present, lets bet on that and ignore the rest of the data 
from here
-if( !pData-getExtDrawings().size() )
+if( pData-getExtDrawings().empty() )
 {
 // layout
 if( !rLayoutPath.isEmpty() )
@@ -459,25 +458,33 @@ void loadDiagram( ShapePtr pShape,
 pDiagram,
 xRefQStyle);
 }
-
-// colors
-if( !rColorStylePath.isEmpty() )
-{
-rtl::Reference core::FragmentHandler  xRefColorStyle(
-new ColorFragmentHandler( rFilter, rColorStylePath, 
pDiagram-getColors() ));
-
-importFragment(rFilter,
-loadFragment(rFilter,xRefColorStyle),
-OOXColor,
-pDiagram,
-xRefColorStyle);
-}
 } else {
 // We still want to add the XDocuments to the DiagramDomMap
 DiagramDomMap rMainDomMap = pDiagram-getDomMap();
 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/qa

2014-04-23 Thread Jacobo Aragunde Pérez
 include/oox/drawingml/effectproperties.hxx   |7 
 include/oox/export/drawingml.hxx |1 
 oox/source/drawingml/effectproperties.cxx|   32 ++
 oox/source/drawingml/effectpropertiescontext.cxx |   29 ++
 oox/source/drawingml/shape.cxx   |   27 ++
 oox/source/export/drawingml.cxx  |  118 +++
 oox/source/export/shapes.cxx |1 
 sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx  |   59 +
 9 files changed, 273 insertions(+), 1 deletion(-)

New commits:
commit 71b4af858ea698f9c3fcffdfc61e3f70a7b10f63
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Tue Apr 22 20:30:24 2014 +0200

ooxml: Preserve outer shadow effect on shapes.

The goal is preserving the shadow effect with all its attributes using
the shape grab bag. This is the relevant piece of XML in the document:

a:effectLst
  a:outerShdw blurRad=50800 dist=38100
  dir=270 algn=tl rotWithShape=0
a:schemeClr val=accent1
  a:alpha val=4 /
/a:schemeClr
  /a:outerShdw
/a:effectLst

In first place, we added members to the structure EffectProperties to
store the effect name and attributes. Later, when we create the shape,
we add them to the shape grab bag together with the shadow color (if
it is a theme color we store its name and transformations like in
other cases). Finally, we read back all these data from the shape grab
bag and write them back to the document.

I added a unit test for this shape property.

Change-Id: Idda2d5e2970cb8563e2ed13a84b2fa2d4b99aa70

diff --git a/include/oox/drawingml/effectproperties.hxx 
b/include/oox/drawingml/effectproperties.hxx
index 83519c0..618c7b9 100644
--- a/include/oox/drawingml/effectproperties.hxx
+++ b/include/oox/drawingml/effectproperties.hxx
@@ -34,6 +34,10 @@ struct OOX_DLLPUBLIC EffectProperties
 {
 EffectShadowProperties maShadow;
 
+/** Store unsupported effect type name and its attributes */
+OptValue OUString  msUnsupportedEffectName;
+std::vector css::beans::PropertyValue  maUnsupportedEffectAttribs;
+
 /** Overwrites all members that are explicitly set in rSourceProps. */
 voidassignUsed( const EffectProperties rSourceProps );
 
@@ -41,6 +45,9 @@ struct OOX_DLLPUBLIC EffectProperties
 voidpushToPropMap(
 PropertyMap rPropMap,
 const GraphicHelper rGraphicHelper ) const;
+
+void appendUnsupportedEffectAttrib( const OUString aKey, const 
css::uno::Any aValue );
+css::beans::PropertyValue getUnsupportedEffect();
 };
 
 
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 3efcf93..7793e6b 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -173,6 +173,7 @@ public:
 void WritePolyPolygon( const PolyPolygon rPolyPolygon );
 void WriteFill( ::com::sun::star::uno::Reference 
::com::sun::star::beans::XPropertySet  xPropSet );
 void WriteShapeStyle( ::com::sun::star::uno::Reference 
::com::sun::star::beans::XPropertySet  rXPropSet );
+void WriteShapeEffects( ::com::sun::star::uno::Reference 
::com::sun::star::beans::XPropertySet  rXPropSet );
 
 static void ResetCounters();
 
diff --git a/oox/source/drawingml/effectproperties.cxx 
b/oox/source/drawingml/effectproperties.cxx
index 7e89726..be3b3d0 100644
--- a/oox/source/drawingml/effectproperties.cxx
+++ b/oox/source/drawingml/effectproperties.cxx
@@ -30,6 +30,8 @@ void EffectShadowProperties::assignUsed(const 
EffectShadowProperties rSourcePro
 void EffectProperties::assignUsed( const EffectProperties rSourceProps )
 {
 maShadow.assignUsed(rSourceProps.maShadow);
+msUnsupportedEffectName.assignIfUsed( rSourceProps.msUnsupportedEffectName 
);
+maUnsupportedEffectAttribs = rSourceProps.maUnsupportedEffectAttribs;
 }
 
 void EffectProperties::pushToPropMap( PropertyMap rPropMap,
@@ -51,6 +53,34 @@ void EffectProperties::pushToPropMap( PropertyMap rPropMap,
 }
 }
 
+void EffectProperties::appendUnsupportedEffectAttrib( const OUString aKey, 
const css::uno::Any aValue )
+{
+css::beans::PropertyValue aProperty;
+aProperty.Name = aKey;
+aProperty.Value = aValue;
+maUnsupportedEffectAttribs.push_back(aProperty);
+}
+
+css::beans::PropertyValue EffectProperties::getUnsupportedEffect()
+{
+css::beans::PropertyValue pRet;
+if(!msUnsupportedEffectName.has())
+return pRet;
+
+css::uno::Sequencecss::beans::PropertyValue 
aSeq(maUnsupportedEffectAttribs.size());
+css::beans::PropertyValue* pSeq = aSeq.getArray();
+for (std::vectorcss::beans::PropertyValue::iterator i = 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sd/qa

2014-03-28 Thread Muthu Subramanian
 include/oox/drawingml/textcharacterproperties.hxx   |2 +
 oox/source/drawingml/textcharacterproperties.cxx|3 +
 oox/source/drawingml/textcharacterpropertiescontext.cxx |4 ++
 sd/qa/unit/data/pptx/n862510_4.pptx |binary
 sd/qa/unit/import-tests.cxx |   27 
 5 files changed, 36 insertions(+)

New commits:
commit 186b96dcfbd0ed87ef414246555e9f953927d692
Author: Muthu Subramanian sumu...@collabora.com
Date:   Fri Mar 28 17:29:37 2014 +0530

Add unit test for text gradfill import.

Change-Id: I803238fd21d1c73aae8146966a5e62e62ad48c5c

diff --git a/sd/qa/unit/data/pptx/n862510_4.pptx 
b/sd/qa/unit/data/pptx/n862510_4.pptx
new file mode 100644
index 000..0a461ee
Binary files /dev/null and b/sd/qa/unit/data/pptx/n862510_4.pptx differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 81f6b8a..462e2ed 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -66,6 +66,7 @@ public:
 void testN862510_1();
 void testN862510_2();
 void testN862510_3();
+void testN862510_4();
 void testFdo71961();
 
 CPPUNIT_TEST_SUITE(SdFiltersTest);
@@ -87,6 +88,7 @@ public:
 CPPUNIT_TEST(testN862510_1);
 CPPUNIT_TEST(testN862510_2);
 CPPUNIT_TEST(testN862510_3);
+CPPUNIT_TEST(testN862510_4);
 CPPUNIT_TEST(testFdo71961);
 
 CPPUNIT_TEST_SUITE_END();
@@ -308,6 +310,31 @@ void SdFiltersTest::testN862510_3()
 }
 }
 
+void SdFiltersTest::testN862510_4()
+{
+::sd::DrawDocShellRef xDocShRef = loadURL( 
getURLFromSrc(/sd/qa/unit/data/pptx/n862510_4.pptx) );
+CPPUNIT_ASSERT_MESSAGE( failed to load, xDocShRef.Is() );
+CPPUNIT_ASSERT_MESSAGE( in destruction, !xDocShRef-IsInDestruction() );
+
+SdDrawDocument *pDoc = xDocShRef-GetDoc();
+CPPUNIT_ASSERT_MESSAGE( no document, pDoc != NULL );
+const SdrPage *pPage = pDoc-GetPage( 1 );
+CPPUNIT_ASSERT_MESSAGE( no page, pPage != NULL );
+{
+std::vectorEECharAttrib rLst;
+SdrObject *pObj = pPage-GetObj( 0 );
+SdrTextObj *pTxtObj = dynamic_castSdrTextObj *( pObj );
+CPPUNIT_ASSERT( pTxtObj );
+const EditTextObject aEdit = 
pTxtObj-GetOutlinerParaObject()-GetTextObject();
+aEdit.GetCharAttribs( 0, rLst );
+for( std::vectorEECharAttrib::reverse_iterator it = rLst.rbegin(); 
it != rLst.rend(); ++it )
+{
+const SvxColorItem *pC = dynamic_castconst SvxColorItem *( 
(*it).pAttr );
+CPPUNIT_ASSERT_MESSAGE( gradfill for text color not handled!, !( 
pC  pC-GetValue().GetColor() == 0 ) );
+}
+}
+}
+
 void SdFiltersTest::testN828390()
 {
 bool bPassed = false;
commit cfc76de83e3c0a56abd30a8f3bd7c69d3500d223
Author: Muthu Subramanian sumu...@collabora.com
Date:   Fri Mar 28 17:24:45 2014 +0530

n#870234: Import gradfill for text colors.

Uses the first color from the gradfill list.
(Which is better than plain black!)

Change-Id: I4c1c0c4b031f3681c95b75b3c0683eb4de95bffb

diff --git a/include/oox/drawingml/textcharacterproperties.hxx 
b/include/oox/drawingml/textcharacterproperties.hxx
index e51937f..4162c23 100644
--- a/include/oox/drawingml/textcharacterproperties.hxx
+++ b/include/oox/drawingml/textcharacterproperties.hxx
@@ -24,6 +24,7 @@
 #include oox/helper/propertymap.hxx
 #include oox/drawingml/color.hxx
 #include oox/drawingml/textfont.hxx
+#include oox/drawingml/fillproperties.hxx
 
 namespace oox { class PropertySet; }
 
@@ -56,6 +57,7 @@ struct TextCharacterProperties
 OptValue bool moItalic;
 OptValue bool moUnderlineLineFollowText;
 OptValue bool moUnderlineFillFollowText;
+GradientFillProperties  maGradientProps; /// Properties for gradient 
text colors
 
 std::vectorcss::beans::PropertyValue maTextEffectsProperties;
 
diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index 6f64f2a..5f7cf4f 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -65,6 +65,7 @@ void TextCharacterProperties::assignUsed( const 
TextCharacterProperties rSource
 moUnderlineFillFollowText.assignIfUsed( 
rSourceProps.moUnderlineFillFollowText );
 
 maTextEffectsProperties = rSourceProps.maTextEffectsProperties;
+maGradientProps.assignUsed( rSourceProps.maGradientProps );
 }
 
 void TextCharacterProperties::pushToPropMap( PropertyMap rPropMap, const 
XmlFilterBase rFilter, bool bUseOptional ) const
@@ -108,6 +109,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap 
rPropMap, const XmlFil
 
 if( maCharColor.isUsed() )
 rPropMap.setProperty( PROP_CharColor, maCharColor.getColor( 
rFilter.getGraphicHelper() ));
+if( maGradientProps.maGradientStops.size()  0 )
+rPropMap[ PROP_CharColor ] = 
maGradientProps.maGradientStops.begin()-second.getColor( 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/qa

2014-03-06 Thread Muthu Subramanian
 include/oox/helper/modelobjecthelper.hxx |4 
 oox/source/drawingml/shape.cxx   |7 +++
 oox/source/helper/modelobjecthelper.cxx  |   15 +++
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |2 +-
 4 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit f1d1c9a6529d575ba3f65872e5ae9e7ac381c6b7
Author: Muthu Subramanian sumu...@collabora.com
Date:   Thu Mar 6 21:21:43 2014 +0530

n#821567: Fix TextFrame background import for sw.

TextFrame in sw unfortunately doesn't seem to
support nametable!

diff --git a/include/oox/helper/modelobjecthelper.hxx 
b/include/oox/helper/modelobjecthelper.hxx
index e57e014..2ced973 100644
--- a/include/oox/helper/modelobjecthelper.hxx
+++ b/include/oox/helper/modelobjecthelper.hxx
@@ -48,6 +48,8 @@ public:
 /** Returns true, if the object with the passed name exists in the 
container. */
 boolhasObject( const OUString rObjName ) const;
 
+::com::sun::star::uno::Any getObject( const OUString rObjName ) const;
+
 /** Inserts the passed object into the container, returns its final name. 
*/
 OUString insertObject(
 const OUString rObjName,
@@ -104,6 +106,8 @@ public:
 an internal constant name with a new unused index appended. */
 OUString insertFillBitmapUrl( const OUString rGraphicUrl );
 
+OUString getFillBitmapUrl( const OUString rGraphicName );
+
 private:
 ObjectContainer maMarkerContainer;  /// Contains all named line 
markers (line end polygons).
 ObjectContainer maDashContainer;/// Contains all named line 
dsahes.
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 883d76f..7d3b0dc 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -35,6 +35,7 @@
 #include oox/core/xmlfilterbase.hxx
 #include oox/helper/graphichelper.hxx
 #include oox/helper/propertyset.hxx
+#include oox/helper/modelobjecthelper.hxx
 
 #include tools/gen.hxx
 #include tools/mapunit.hxx
@@ -691,6 +692,12 @@ Reference XShape  Shape::createAndInsert(
 aShapeProps.setProperty(PROP_BackGraphicURL, 
aShapeProps.getProperty(PROP_FillBitmapURL));
 aShapeProps.erase(PROP_FillBitmapURL);
 }
+if (aShapeProps.hasProperty(PROP_FillBitmapName))
+{
+uno::Any aAny = aShapeProps[PROP_FillBitmapName];
+aShapeProps.setProperty(PROP_BackGraphicURL, 
rFilterBase.getModelObjectHelper().getFillBitmapUrl( aAny.getOUString() ));
+// aShapeProps.erase(PROP_FillBitmapName);  // Maybe, 
leave the name as well
+}
 // And no LineColor property; individual borders can have 
colors
 if (aShapeProps.hasProperty(PROP_LineColor))
 {
diff --git a/oox/source/helper/modelobjecthelper.cxx 
b/oox/source/helper/modelobjecthelper.cxx
index 5a966fe..1ec45af 100644
--- a/oox/source/helper/modelobjecthelper.cxx
+++ b/oox/source/helper/modelobjecthelper.cxx
@@ -56,6 +56,13 @@ bool ObjectContainer::hasObject( const OUString rObjName ) 
const
 return mxContainer.is()  mxContainer-hasByName( rObjName );
 }
 
+Any ObjectContainer::getObject( const OUString rObjName ) const
+{
+if( hasObject( rObjName ) )
+return mxContainer-getByName( rObjName );
+return Any();
+}
+
 OUString ObjectContainer::insertObject( const OUString rObjName, const Any 
rObj, bool bInsertByUnusedName )
 {
 createContainer();
@@ -132,6 +139,14 @@ OUString ModelObjectHelper::insertFillBitmapUrl( const 
OUString rGraphicUrl )
 return OUString();
 }
 
+OUString ModelObjectHelper::getFillBitmapUrl( const OUString rGraphicName )
+{
+Any aAny = maBitmapUrlContainer.getObject( rGraphicName );
+if( aAny.hasValue() )
+return aAny.getOUString();
+return OUString();
+}
+
 
 
 } // namespace oox
commit ad737e7ff4bf12d8b66ceb2001aebf54ff5badba
Author: Muthu Subramanian sumu...@collabora.com
Date:   Thu Mar 6 18:16:46 2014 +0530

Re-enable the unit test (BackGraphicURL).

diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx 
b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 28a8bfd..c51b58a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2116,7 +2116,7 @@ DECLARE_OOXMLEXPORT_TEST(testTextBoxPictureFill, 
textbox_picturefill.docx)
 {
 uno::Referencebeans::XPropertySet xFrame(getShape(1), uno::UNO_QUERY);
 CPPUNIT_ASSERT_EQUAL(drawing::FillStyle_BITMAP, 
getPropertydrawing::FillStyle(xFrame, FillStyle));
-
//CPPUNIT_ASSERT(!(getPropertyOUString(xFrame,BackGraphicURL)).isEmpty());
+
CPPUNIT_ASSERT(!(getPropertyOUString(xFrame,BackGraphicURL)).isEmpty());
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFDO73034, FDO73034.docx)
___
Libreoffice-commits mailing list

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source

2014-02-23 Thread Zolnai Tamás
 include/oox/drawingml/textparagraphpropertiescontext.hxx |2 --
 include/oox/drawingml/textspacing.hxx|3 ++-
 oox/source/drawingml/textparagraphpropertiescontext.cxx  |6 ++
 3 files changed, 4 insertions(+), 7 deletions(-)

New commits:
commit b0073ef79efe65d8094d479faf0c4b657dffbfb0
Author: Zolnai Tamás tamas.zol...@collabora.com
Date:   Sun Feb 23 16:15:06 2014 +0100

drawingML import: reduce code duplication

Change-Id: I7730fb047a10f270498bbf6f1a89dde034514121

diff --git a/include/oox/drawingml/textspacing.hxx 
b/include/oox/drawingml/textspacing.hxx
index e36ca72..4c859d7 100644
--- a/include/oox/drawingml/textspacing.hxx
+++ b/include/oox/drawingml/textspacing.hxx
@@ -24,6 +24,7 @@
 
 #include com/sun/star/style/LineSpacing.hpp
 #include com/sun/star/style/LineSpacingMode.hpp
+#include oox/drawingml/drawingmltypes.hxx
 
 namespace oox { namespace drawingml {
 
@@ -53,7 +54,7 @@ namespace oox { namespace drawingml {
 sal_Int32 toMargin( float fFontSize ) const
 {
 if ( nUnit == PERCENT )
-return (sal_Int32) fFontSize*nValue)/1000)*254 + 
360)/720);
+return 
GetTextSpacingPoint(static_castsal_Int32((fFontSize*nValue)/1000));
 else
 return nValue;
 }
commit a35a29829d1899e441a969de6d1045fd17e4639b
Author: Zolnai Tamás tamas.zol...@collabora.com
Date:   Sun Feb 23 16:09:34 2014 +0100

drawingML import: remove some unneeded member

Change-Id: Iea975665b9225e535dcc4fbdcd666d7c7bff8ef3

diff --git a/include/oox/drawingml/textparagraphpropertiescontext.hxx 
b/include/oox/drawingml/textparagraphpropertiescontext.hxx
index d1a5fa8..0d3dc98 100644
--- a/include/oox/drawingml/textparagraphpropertiescontext.hxx
+++ b/include/oox/drawingml/textparagraphpropertiescontext.hxx
@@ -43,8 +43,6 @@ public:
 protected:
 TextParagraphProperties mrTextParagraphProperties;
 TextSpacing maLineSpacing;
-TextSpacingmrSpaceBefore;
-TextSpacingmrSpaceAfter;
 BulletList mrBulletList;
 ::std::list ::com::sun::star::style::TabStop   maTabList;
 ::boost::shared_ptr BlipFillProperties  mxBlipProps;
diff --git a/oox/source/drawingml/textparagraphpropertiescontext.cxx 
b/oox/source/drawingml/textparagraphpropertiescontext.cxx
index 9e05446..a47d37f 100644
--- a/oox/source/drawingml/textparagraphpropertiescontext.cxx
+++ b/oox/source/drawingml/textparagraphpropertiescontext.cxx
@@ -47,8 +47,6 @@ 
TextParagraphPropertiesContext::TextParagraphPropertiesContext( ContextHandler2H
 
TextParagraphProperties rTextParagraphProperties )
 : ContextHandler2( rParent )
 , mrTextParagraphProperties( rTextParagraphProperties )
-, mrSpaceBefore( rTextParagraphProperties.getParaTopMargin() )
-, mrSpaceAfter( rTextParagraphProperties.getParaBottomMargin() )
 , mrBulletList( rTextParagraphProperties.getBulletList() )
 {
 OUString sValue;
@@ -171,9 +169,9 @@ ContextHandlerRef 
TextParagraphPropertiesContext::onCreateContext( sal_Int32 aEl
 case A_TOKEN( lnSpc ):  // CT_TextSpacing
 return new TextSpacingContext( *this, maLineSpacing );
 case A_TOKEN( spcBef ): // CT_TextSpacing
-return new TextSpacingContext( *this, mrSpaceBefore );
+return new TextSpacingContext( *this, 
mrTextParagraphProperties.getParaTopMargin() );
 case A_TOKEN( spcAft ): // CT_TextSpacing
-return new TextSpacingContext( *this, mrSpaceAfter );
+return new TextSpacingContext( *this, 
mrTextParagraphProperties.getParaBottomMargin() );
 // EG_TextBulletColor
 case A_TOKEN( buClrTx ):// CT_TextBulletColorFollowText ???
 mrBulletList.mbBulletColorFollowText = sal_True;
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/qa

2014-01-28 Thread Jacobo Aragunde Pérez
 include/oox/drawingml/color.hxx |   11 
 include/oox/drawingml/lineproperties.hxx|9 
 include/oox/export/drawingml.hxx|1 
 oox/source/drawingml/color.cxx  |  101 +++
 oox/source/drawingml/lineproperties.cxx |   25 +
 oox/source/drawingml/shape.cxx  |   41 ++-
 oox/source/export/drawingml.cxx |  152 
 sw/qa/extras/ooxmlexport/data/shape-theme-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx|   53 +++-
 9 files changed, 340 insertions(+), 53 deletions(-)

New commits:
commit 5391d4872e71d1edba7acc4ad2d2e3b5b97e1723
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Mon Jan 27 19:46:37 2014 +0100

ooxml: Preserve shape style and theme attributes for line

Line style and color can be defined by the shape style attributes or
can be directly assigned by the user (and even using a theme color in
the case of color attribute). This patch aims to preserve the
relevant attributes of this feature after a roundtrip.

For style attributes (wps:style/a:lnRef), they are kept and preserved
in the StyleLnRef property of the shape InteropGrabBag. To be able
to access to some of them, the methods getLineStyle, getLineJoint and
getLineWidth were added to LineProperties object.

For the line theme color (a:ln/a:solidFill/a:schemeClr), the original
line color and the theme color name are preserved in the properties
OriginalLnSolidFillClr and SpPrLnSolidFillSchemeClrof the Shape
InteropGrabBag.

On export time, we must check if the user has changed any properties
of the shape line, this is done comparing the new shape attributes
with the original values coming from the style and theme definitions.
In case some of the attributes is different, the new attribute must
be saved overwriting the old one.

The data files for some /sd/qa/ unit tests were updated to reflect
the new properties inside the Shape InteropGrabBag. Besides, an
existing unit test in ooxmlexport was modified to include checks for
the preservation of line style, line theme color and custom line
style that override the style attributes.

Change-Id: Iabb0cef9e3cc433676c201bc296fb7b373839a3f

diff --git a/include/oox/drawingml/lineproperties.hxx 
b/include/oox/drawingml/lineproperties.hxx
index 7cc31a3..2b6494e 100644
--- a/include/oox/drawingml/lineproperties.hxx
+++ b/include/oox/drawingml/lineproperties.hxx
@@ -20,6 +20,8 @@
 #ifndef INCLUDED_OOX_DRAWINGML_LINEPROPERTIES_HXX
 #define INCLUDED_OOX_DRAWINGML_LINEPROPERTIES_HXX
 
+#include com/sun/star/drawing/LineJoint.hpp
+#include com/sun/star/drawing/LineStyle.hpp
 #include oox/drawingml/fillproperties.hxx
 
 namespace oox {
@@ -62,6 +64,13 @@ struct OOX_DLLPUBLIC LineProperties
 ShapePropertyMap rPropMap,
 const GraphicHelper rGraphicHelper,
 sal_Int32 nPhClr = API_RGB_TRANSPARENT ) const;
+
+/** Calculates the line style attribute from the internal state of the 
object */
+::com::sun::star::drawing::LineStyle  getLineStyle() const;
+/** Calculates the line joint attribute from the internal state of the 
object */
+::com::sun::star::drawing::LineJoint  getLineJoint() const;
+/** Calculates the line width attribute from the internal state of the 
object */
+sal_Int32   getLineWidth() const;
 };
 
 // 
diff --git a/oox/source/drawingml/lineproperties.cxx 
b/oox/source/drawingml/lineproperties.cxx
index df0ce89..2fca061 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -370,7 +370,7 @@ void LineProperties::pushToPropMap( ShapePropertyMap 
rPropMap,
 drawing::LineStyle eLineStyle = (maLineFill.moFillType.get() == 
XML_noFill) ? drawing::LineStyle_NONE : drawing::LineStyle_SOLID;
 
 // convert line width from EMUs to 1/100mm
-sal_Int32 nLineWidth = convertEmuToHmm( moLineWidth.get( 0 ) );
+sal_Int32 nLineWidth = getLineWidth();
 
 // create line dash from preset dash token (not for invisible line)
 if( (eLineStyle != drawing::LineStyle_NONE)  
(moPresetDash.differsFrom( XML_solid ) || !maCustomDash.empty()) )
@@ -419,6 +419,29 @@ void LineProperties::pushToPropMap( ShapePropertyMap 
rPropMap,
 }
 }
 
+drawing::LineStyle LineProperties::getLineStyle() const
+{
+// rules to calculate the line style inferred from the code in 
LineProperties::pushToPropMap
+return (maLineFill.moFillType.get() == XML_noFill) ?
+drawing::LineStyle_NONE :
+(moPresetDash.differsFrom( XML_solid ) || (!moPresetDash  
!maCustomDash.empty())) ?
+  

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/qa

2014-01-28 Thread Jacobo Aragunde Pérez
 include/oox/drawingml/shape.hxx  |2 +
 oox/source/drawingml/shape.cxx   |   39 +--
 oox/source/export/drawingml.cxx  |8 +++---
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx |6 
 4 files changed, 34 insertions(+), 21 deletions(-)

New commits:
commit 2c9c3d3ef52db1571064036800feaa9a9ebd4bb4
Author: Jacobo Aragunde Pérez jaragu...@igalia.com
Date:   Tue Jan 28 13:51:16 2014 +0100

ooxml: Small code refactor

* Use PUT_PROPS macro in all cases.
* Added putPropertyToGrabBag( OUString, Any ) to avoid the explicit
  creation of a PropertyValue object every time.

Change-Id: If098dd3a94d1843c4c5dbc3a507b05754d9d59c7

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index c1618ba6..1419a15 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -218,6 +218,8 @@ protected:
 const ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShapes  rxShapes );
 
 voidputPropertyToGrabBag(
+const OUString sPropertyName, const 
::com::sun::star::uno::Any aPropertyValue );
+voidputPropertyToGrabBag(
 const ::com::sun::star::beans::PropertyValue 
pProperty );
 voidputPropertiesToGrabBag(
 const ::com::sun::star::uno::Sequence 
::com::sun::star::beans::PropertyValue  aProperties );
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index b2d0300..3259f72 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -569,10 +569,7 @@ Reference XShape  Shape::createAndInsert(
 PUT_PROP( aProperties, 4, LineJoint,  
aLineProperties.getLineJoint() );
 PUT_PROP( aProperties, 5, LineWidth,  
aLineProperties.getLineWidth() );
 PUT_PROP( aProperties, 6, Transformations, 
pLineRef-maPhClr.getTransformations() );
-PropertyValue pStyleFillRef;
-pStyleFillRef.Name = StyleLnRef;
-pStyleFillRef.Value = Any( aProperties );
-putPropertyToGrabBag( pStyleFillRef );
+putPropertyToGrabBag( StyleLnRef, Any( aProperties ) );
 }
 if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef 
) )
 {
@@ -584,19 +581,12 @@ Reference XShape  Shape::createAndInsert(
 if( !sColorScheme.isEmpty() )
 {
 Sequence PropertyValue  aProperties(4);
-aProperties[0].Name = SchemeClr;
-aProperties[0].Value = Any( sColorScheme );
-aProperties[1].Name = Idx;
-aProperties[1].Value = Any( pFillRef-mnThemedIdx );
-aProperties[2].Name = Color;
-aProperties[2].Value = Any( nFillPhClr );
-aProperties[3].Name = Transformations;
-aProperties[3].Value = Any( 
pFillRef-maPhClr.getTransformations() );
-
-PropertyValue pStyleFillRef;
-pStyleFillRef.Name = StyleFillRef;
-pStyleFillRef.Value = Any( aProperties );
-putPropertyToGrabBag( pStyleFillRef );
+PUT_PROP( aProperties, 0, SchemeClr,  sColorScheme );
+PUT_PROP( aProperties, 1, Idx,
pFillRef-mnThemedIdx );
+PUT_PROP( aProperties, 2, Color,  nFillPhClr );
+PUT_PROP( aProperties, 3, Transformations, 
pFillRef-maPhClr.getTransformations() );
+
+putPropertyToGrabBag( StyleFillRef, Any( aProperties ) );
 }
 }
 if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( 
XML_effectRef ) )
@@ -611,10 +601,7 @@ Reference XShape  Shape::createAndInsert(
 PUT_PROP( aProperties, 0, SchemeClr,  
pEffectRef-maPhClr.getSchemeName() );
 PUT_PROP( aProperties, 1, Idx,
pEffectRef-mnThemedIdx );
 PUT_PROP( aProperties, 2, Transformations, 
pEffectRef-maPhClr.getTransformations() );
-PropertyValue pStyleFillRef;
-pStyleFillRef.Name = StyleEffectRef;
-pStyleFillRef.Value = Any( aProperties );
-putPropertyToGrabBag( pStyleFillRef );
+putPropertyToGrabBag( StyleEffectRef, Any( aProperties ) );
 }
 }
 
@@ -1100,6 +1087,14 @@ void Shape::finalizeXShape( XmlFilterBase rFilter, 
const Reference XShapes 
 }
 }
 
+void Shape::putPropertyToGrabBag( const OUString sPropertyName, const Any 
aPropertyValue )
+{
+PropertyValue pNewProperty;
+pNewProperty.Name = sPropertyName;
+pNewProperty.Value = aPropertyValue;
+putPropertyToGrabBag( pNewProperty );
+}
+
 void 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/source

2013-12-12 Thread Miklos Vajna
 include/oox/export/shapes.hxx   |2 ++
 oox/source/export/shapes.cxx|   27 ---
 sw/source/filter/ww8/docxexport.cxx |4 +++-
 3 files changed, 29 insertions(+), 4 deletions(-)

New commits:
commit dbdc31fc0a09181d80909819d93a2dacde3eac79
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Dec 12 14:32:39 2013 +0100

oox: initial ShapeExport::WriteGroupShape

For now, enable it only for DOCX.

Change-Id: I424d8fb3f1c1e7c9a03e7103c91473c3ff85bc77

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 65fafc9..bfcaaf7 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -94,6 +94,8 @@ public:
 virtual ShapeExport
 WriteGraphicObjectShape( 
::com::sun::star::uno::Reference ::com::sun::star::drawing::XShape  xShape );
 virtual ShapeExport
+WriteGroupShape( ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShape  xShape );
+virtual ShapeExport
 WriteLineShape( ::com::sun::star::uno::Reference 
::com::sun::star::drawing::XShape  xShape );
 virtual ShapeExport
 WriteNonVisualDrawingProperties( 
::com::sun::star::uno::Reference ::com::sun::star::drawing::XShape  xShape, 
const char* sName );
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 5689215..e2e7a13 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -243,6 +243,25 @@ ShapeExport ShapeExport::WriteOpenBezierShape( Reference 
XShape  xShape )
 return WriteBezierShape( xShape, sal_False );
 }
 
+ShapeExport ShapeExport::WriteGroupShape(uno::Referencedrawing::XShape 
xShape)
+{
+FSHelperPtr pFS = GetFS();
+pFS-startElementNS(mnXmlNamespace, XML_wgp, FSEND);
+
+// non visual properties
+pFS-singleElementNS(mnXmlNamespace, XML_cNvGrpSpPr, FSEND);
+
+// visual properties
+pFS-startElementNS(mnXmlNamespace, XML_grpSpPr, FSEND);
+WriteShapeTransformation(xShape, XML_a);
+pFS-endElementNS(mnXmlNamespace, XML_grpSpPr);
+
+// TODO: children
+
+pFS-endElementNS(mnXmlNamespace, XML_wgp);
+return *this;
+}
+
 ShapeExport ShapeExport::WriteCustomShape( Reference XShape  xShape )
 {
 DBG(printf(write custom shape\n));
@@ -679,7 +698,7 @@ ShapeExport ShapeExport::WriteRectangleShape( Reference 
XShape  xShape )
 typedef ShapeExport (ShapeExport::*ShapeConverter)( Reference XShape  );
 typedef boost::unordered_map const char*, ShapeConverter, rtl::CStringHash, 
rtl::CStringEqual NameToConvertMapType;
 
-static const NameToConvertMapType lcl_GetConverters()
+static const NameToConvertMapType lcl_GetConverters(DrawingML::DocumentType 
eDocumentType)
 {
 static bool shape_map_inited = false;
 static NameToConvertMapType shape_converters;
@@ -712,6 +731,8 @@ static const NameToConvertMapType lcl_GetConverters()
 shape_converters[ com.sun.star.presentation.OutlinerShape ]   = 
ShapeExport::WriteTextShape;
 shape_converters[ com.sun.star.presentation.SlideNumberShape ]= 
ShapeExport::WriteTextShape;
 shape_converters[ com.sun.star.presentation.TitleTextShape ]  = 
ShapeExport::WriteTextShape;
+if (eDocumentType == DrawingML::DOCUMENT_DOCX)
+shape_converters[ com.sun.star.drawing.GroupShape ] = 
ShapeExport::WriteGroupShape;
 shape_map_inited = true;
 
 return shape_converters;
@@ -721,8 +742,8 @@ ShapeExport ShapeExport::WriteShape( Reference XShape  
xShape )
 {
 OUString sShapeType = xShape-getShapeType();
 DBG( printf( write shape: %s\n, USS( sShapeType ) ) );
-NameToConvertMapType::const_iterator aConverter = 
lcl_GetConverters().find( USS( sShapeType ) );
-if( aConverter == lcl_GetConverters().end() )
+NameToConvertMapType::const_iterator aConverter = 
lcl_GetConverters(GetDocumentType()).find( USS( sShapeType ) );
+if( aConverter == lcl_GetConverters(GetDocumentType()).end() )
 {
 DBG( printf( unknown shape\n ) );
 return WriteUnknownShape( xShape );
commit 10c3c9ec9b6af1b4124ff2cd458d22f13f4ebc39
Author: Miklos Vajna vmik...@collabora.co.uk
Date:   Thu Dec 12 14:26:45 2013 +0100

DocxExport::OutputDML: use the right namespace for groupshapes

Change-Id: Idd270e5519587440fe96e73f5cf51851f7680d59

diff --git a/sw/source/filter/ww8/docxexport.cxx 
b/sw/source/filter/ww8/docxexport.cxx
index 35383d4..6c7a66b 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -331,7 +331,9 @@ OString DocxExport::OutputChart( uno::Reference 
frame::XModel  xModel, sal_In
 
 void DocxExport::OutputDML(uno::Referencedrawing::XShape xShape)
 {
-oox::drawingml::ShapeExport aExport(XML_wps, m_pDocumentFS, 0, m_pFilter, 
oox::drawingml::DrawingML::DOCUMENT_DOCX, m_pAttrOutput);
+uno::Referencelang::XServiceInfo xServiceInfo(xShape, 
uno::UNO_QUERY_THROW);
+bool bGroupShape = 

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source

2013-09-16 Thread Jan Holesovsky
 include/oox/drawingml/shape.hxx  |1 -
 oox/source/drawingml/shape.cxx   |7 ---
 oox/source/ppt/extdrawingfragmenthandler.cxx |   13 -
 oox/source/ppt/extdrawingfragmenthandler.hxx |1 -
 4 files changed, 4 insertions(+), 18 deletions(-)

New commits:
commit ba511f8002a2da521f06c3a6a0c60aa6de79d170
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon Sep 16 16:46:46 2013 +0200

Related bnc#819614: Set the position and name immediately.

Change-Id: I4c1046040f52e261004df95125b53e42dc8fca4b

diff --git a/oox/source/ppt/extdrawingfragmenthandler.cxx 
b/oox/source/ppt/extdrawingfragmenthandler.cxx
index 9fbf0a5..d2b892f 100644
--- a/oox/source/ppt/extdrawingfragmenthandler.cxx
+++ b/oox/source/ppt/extdrawingfragmenthandler.cxx
@@ -47,6 +47,9 @@ ExtDrawingFragmentHandler::onCreateContext( ::sal_Int32 
aElement,
 break;
 case DSP_TOKEN( spTree ):
 mpShapePtr = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, 
com.sun.star.drawing.GroupShape ) );
+mpShapePtr-setPosition( mpOrgShapePtr-getPosition() );
+mpShapePtr-setName( mpOrgShapePtr-getName() );
+
 return new PPTShapeGroupContext(
 *this, mpSlidePersistPtr, meShapeLocation, mpGroupShapePtr,
 mpShapePtr );
@@ -56,14 +59,6 @@ ExtDrawingFragmentHandler::onCreateContext( ::sal_Int32 
aElement,
 
 return this;
 }
-void SAL_CALL ExtDrawingFragmentHandler::endDocument() throw 
(::com::sun::star::xml::sax::SAXException, 
::com::sun::star::uno::RuntimeException)
-{
-if( mpShapePtr )
-{
-mpShapePtr-setPosition( mpOrgShapePtr-getPosition() );
-mpShapePtr-setName( mpOrgShapePtr-getName() );
-}
-}
 
 } }
 
diff --git a/oox/source/ppt/extdrawingfragmenthandler.hxx 
b/oox/source/ppt/extdrawingfragmenthandler.hxx
index 0b186eb..8de27ef 100644
--- a/oox/source/ppt/extdrawingfragmenthandler.hxx
+++ b/oox/source/ppt/extdrawingfragmenthandler.hxx
@@ -30,7 +30,6 @@ public:
 oox::drawingml::ShapePtr pShapePtr ) throw();
 virtual ~ExtDrawingFragmentHandler() throw();
 
-virtual void SAL_CALL endDocument() throw 
(::com::sun::star::xml::sax::SAXException, 
::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
 virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 
Element, const AttributeList rAttribs ) SAL_OVERRIDE;
 
 private:
commit 59373b753902f69cd44d183568b084429322e7ab
Author: Jan Holesovsky ke...@collabora.com
Date:   Mon Sep 16 16:30:45 2013 +0200

Related bnc#819614: The diagram is a group.

It is not really desired to import diagrams broken into individual objects;
makes trouble with the hieararchy, and also the user wants to see it as a
group - can be ungrouped for modifications easily.

Change-Id: I0533a69af9e377804bf0e06b2ce873fd0c9bde02

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index dbe17c1..95108e7 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -101,7 +101,6 @@ public:
 
 void  setChildPosition( 
com::sun::star::awt::Point nPosition ){ maChPosition = nPosition; }
 void  setChildSize( com::sun::star::awt::Size 
aSize ){ maChSize = aSize; }
-void  moveAllToPosition( const 
com::sun::star::awt::Point rPoint );
 
 void  setPosition( com::sun::star::awt::Point 
nPosition ){ maPosition = nPosition; }
 const com::sun::star::awt::Point getPosition() const { return maPosition; 
}
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index d8d127a..44a43ff 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -665,13 +665,6 @@ TextBodyPtr Shape::getTextBody()
 return mpTextBody;
 }
 
-void Shape::moveAllToPosition( const awt::Point rPoint )
-{
-setPosition( awt::Point( rPoint.X + maPosition.X, rPoint.Y + maPosition.Y 
) );
-for( ::std::vectorShapePtr::const_iterator aIt = maChildren.begin(), 
aEnd = maChildren.end();aIt != aEnd; ++aIt )
-(*aIt)-moveAllToPosition( rPoint );
-}
-
 void Shape::setMasterTextListStyle( const TextListStylePtr 
pMasterTextListStyle )
 {
 SAL_INFO(oox.drawingml, OSL_THIS_FUNC  set master text list style to 
shape id:   msId);
diff --git a/oox/source/ppt/extdrawingfragmenthandler.cxx 
b/oox/source/ppt/extdrawingfragmenthandler.cxx
index e6d4b2f..9fbf0a5 100644
--- a/oox/source/ppt/extdrawingfragmenthandler.cxx
+++ b/oox/source/ppt/extdrawingfragmenthandler.cxx
@@ -48,7 +48,7 @@ ExtDrawingFragmentHandler::onCreateContext( ::sal_Int32 
aElement,
 case DSP_TOKEN( spTree ):
 mpShapePtr = oox::drawingml::ShapePtr( new PPTShape( meShapeLocation, 
com.sun.star.drawing.GroupShape ) );
 return new PPTShapeGroupContext(
-*this, mpSlidePersistPtr, meShapeLocation, 
mpSlidePersistPtr-getShapes(),
+   

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/qa

2013-06-21 Thread Miklos Vajna
 include/oox/drawingml/shape.hxx |3 +++
 oox/source/drawingml/shape.cxx  |   18 ++
 oox/source/drawingml/shapegroupcontext.cxx  |6 +-
 oox/source/shape/LockedCanvasContext.cxx|2 ++
 sw/qa/extras/ooxmlimport/data/fdo43641.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx|   13 +
 6 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit 832612bb6bd013cf68a64e33827158f96e6d03d3
Author: Miklos Vajna vmik...@suse.cz
Date:   Fri Jun 21 10:31:19 2013 +0200

fdo#43641 testcase

Change-Id: I3426c7c23eb23fa7f91320ac036b0eb565bbc330

diff --git a/sw/qa/extras/ooxmlimport/data/fdo43641.docx 
b/sw/qa/extras/ooxmlimport/data/fdo43641.docx
new file mode 100644
index 000..90622f8
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/fdo43641.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx 
b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 676fbbb..4f23d92 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -43,6 +43,7 @@
 #include bordertest.hxx
 
 #define TWIP_TO_MM100(TWIP) ((TWIP) = 0 ? (((TWIP)*127L+36L)/72L) : 
(((TWIP)*127L-36L)/72L))
+#define EMU_TO_MM100(EMU) (EMU / 360)
 
 class Test : public SwModelTestBase
 {
@@ -119,6 +120,7 @@ public:
 void testN820509();
 void testN820788();
 void testN820504();
+void testFdo43641();
 
 CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX)  !defined(WNT)
@@ -205,6 +207,7 @@ void Test::run()
 {n820509.docx, Test::testN820509},
 {n820788.docx, Test::testN820788},
 {n820504.docx, Test::testN820504},
+{fdo43641.docx, Test::testFdo43641},
 };
 header();
 for (unsigned int i = 0; i  SAL_N_ELEMENTS(aMethods); ++i)
@@ -1449,6 +1452,16 @@ void Test::testN820504()
 CPPUNIT_ASSERT_EQUAL(sal_Int32(4040635), getPropertysal_Int32(xStyle, 
CharColor));
 }
 
+void Test::testFdo43641()
+{
+uno::Referencedrawing::XDrawPageSupplier xDrawPageSupplier(mxComponent, 
uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess 
xDraws(xDrawPageSupplier-getDrawPage(), uno::UNO_QUERY);
+uno::Referencecontainer::XIndexAccess xGroupShape(xDraws-getByIndex(0), 
uno::UNO_QUERY);
+uno::Referencedrawing::XShape xLine(xGroupShape-getByIndex(1), 
uno::UNO_QUERY);
+// This was 2200, not 2579 in mm100, i.e. the size of the line shape was 
incorrect.
+CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(928694)), 
xLine-getSize().Width);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 76a90e69d15104f76193647050948528caf6ff8d
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Jun 20 20:56:26 2013 +0200

fdo#43641 oox: fix position/size of LineShapes inside lockedCanvas

Change-Id: Idf14d40f174ca87543a829ccfe22ed5cbb8e3cbc

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index f8a58ec..94c8342 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -172,6 +172,8 @@ public:
 const ::std::vectorOUString
 getExtDrawings() { return maExtDrawings; }
 voidaddExtDrawingRelId( const OUString rRelId ) { 
maExtDrawings.push_back( rRelId ); }
+voidsetLockedCanvas(bool bLockedCanvas);
+boolgetLockedCanvas();
 
 protected:
 
@@ -262,6 +264,7 @@ private:
 sal_BoolmbHiddenMasterShape; // master shapes can 
be hidden in layout slides
  // we need separate 
flag because we don't want
  // to propagate it 
when applying reference shape
+bool mbLockedCanvas; /// Is this shape part of a locked canvas?
 };
 
 // 
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index acb7128..0d3a286 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -81,6 +81,7 @@ Shape::Shape( const sal_Char* pServiceName )
 , mbFlipV( false )
 , mbHidden( false )
 , mbHiddenMasterShape( false )
+, mbLockedCanvas( false )
 {
 if ( pServiceName )
 msServiceName = OUString::createFromAscii( pServiceName );
@@ -115,6 +116,7 @@ Shape::Shape( const ShapePtr pSourceShape )
 , mbFlipV( pSourceShape-mbFlipV )
 , mbHidden( pSourceShape-mbHidden )
 , mbHiddenMasterShape( pSourceShape-mbHiddenMasterShape )
+, mbLockedCanvas( pSourceShape-mbLockedCanvas )
 {}
 
 
@@ -223,6 +225,16 @@ void Shape::addShape(
 }
 }
 
+void Shape::setLockedCanvas(bool bLockedCanvas)
+{
+mbLockedCanvas = bLockedCanvas;
+}
+
+bool Shape::getLockedCanvas()
+{
+return mbLockedCanvas;
+}
+
 void Shape::applyShapeReference( const Shape rReferencedShape, bool bUseText )
 {
 SAL_INFO(oox, apply shape reference:   rReferencedShape.msId   to 
shape id:   msId);

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sw/source

2013-06-13 Thread Miklos Vajna
 include/oox/export/vmlexport.hxx |5 -
 oox/source/export/vmlexport.cxx  |  109 ++-
 sw/source/filter/ww8/docxattributeoutput.cxx |6 +
 3 files changed, 116 insertions(+), 4 deletions(-)

New commits:
commit 175d28d564ff552cd3d73c3b087216bc82a763a1
Author: Miklos Vajna vmik...@suse.cz
Date:   Thu Jun 13 17:02:11 2013 +0200

fdo#58819 VML export of mso-position-*

mso-position-horizontal, mso-position-horizontal-relative,
mso-position-vertical and mso-position-vertical-relative

With this, the watermark in the bugdoc is almost in place, if you ignore
the missing rotation.

Change-Id: I8d3d834089e734654fcbbb0fb6166b4d7e01f80f

diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 4e790c5..31f5241 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -50,6 +50,9 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx
 /// Parent exporter, used for text callback.
 VMLTextExport* m_pTextExport;
 
+/// Anchoring.
+sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel;
+
 /// The object we're exporting.
 const SdrObject* m_pSdrObject;
 
@@ -80,7 +83,7 @@ public:
 /// Export the sdr object as VML.
 ///
 /// Call this when you need to export the object as VML.
-sal_uInt32 AddSdrObject( const SdrObject rObj );
+sal_uInt32 AddSdrObject( const SdrObject rObj, const sal_Int16 eHOri = 
-1, const sal_Int16 eVOri = -1, const sal_Int16 eHRel = -1, const sal_Int16 
eVRel = -1 );
 
 protected:
 /// Add an attribute to the generated v:shape/ element.
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index e2df5cf..a93bdb5 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -29,16 +29,25 @@
 #include vcl/cvtgrf.hxx
 #include filter/msfilter/msdffimp.hxx
 
+#include com/sun/star/text/HoriOrientation.hpp
+#include com/sun/star/text/VertOrientation.hpp
+#include com/sun/star/text/RelOrientation.hpp
+
 #include cstdio
 
 
 using namespace sax_fastparser;
 using namespace oox::vml;
+using namespace com::sun::star;
 
 VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, 
VMLTextExport* pTextExport )
 : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), 0 )
 , m_pSerializer( pSerializer )
 , m_pTextExport( pTextExport )
+, m_eHOri( 0 )
+, m_eVOri( 0 )
+, m_eHRel( 0 )
+, m_eVRel( 0 )
 , m_pSdrObject( 0 )
 , m_pShapeAttrList( NULL )
 , m_nShapeType( ESCHER_ShpInst_Nil )
@@ -854,6 +863,77 @@ sal_Int32 VMLExport::StartShape()
 break;
 }
 
+// anchoring
+switch (m_eHOri)
+{
+case text::HoriOrientation::LEFT:
+m_pShapeStyle-append(;mso-position-horizontal:left);
+break;
+case text::HoriOrientation::CENTER:
+m_pShapeStyle-append(;mso-position-horizontal:center);
+break;
+case text::HoriOrientation::RIGHT:
+m_pShapeStyle-append(;mso-position-horizontal:right);
+break;
+case text::HoriOrientation::INSIDE:
+m_pShapeStyle-append(;mso-position-horizontal:inside);
+break;
+case text::HoriOrientation::OUTSIDE:
+m_pShapeStyle-append(;mso-position-horizontal:outside);
+break;
+default:
+case text::HoriOrientation::NONE:
+break;
+}
+switch (m_eHRel)
+{
+case text::RelOrientation::PAGE_PRINT_AREA:
+m_pShapeStyle-append(;mso-position-horizontal-relative:margin);
+break;
+case text::RelOrientation::PAGE_FRAME:
+case text::RelOrientation::PAGE_LEFT:
+case text::RelOrientation::PAGE_RIGHT:
+m_pShapeStyle-append(;mso-position-horizontal-relative:page);
+break;
+case text::RelOrientation::CHAR:
+m_pShapeStyle-append(;mso-position-horizontal-relative:char);
+break;
+default:
+break;
+}
+
+switch (m_eVOri)
+{
+case text::VertOrientation::TOP:
+case text::VertOrientation::LINE_TOP:
+case text::VertOrientation::CHAR_TOP:
+m_pShapeStyle-append(;mso-position-vertical:top);
+break;
+case text::VertOrientation::CENTER:
+case text::VertOrientation::LINE_CENTER:
+m_pShapeStyle-append(;mso-position-vertical:center);
+break;
+case text::VertOrientation::BOTTOM:
+case text::VertOrientation::LINE_BOTTOM:
+case text::VertOrientation::CHAR_BOTTOM:
+m_pShapeStyle-append(;mso-position-vertical:bottom);
+break;
+default:
+case text::VertOrientation::NONE:
+break;
+}
+switch (m_eVRel)
+{
+case text::RelOrientation::PAGE_PRINT_AREA:
+m_pShapeStyle-append(;mso-position-vertical-relative:margin);
+break;
+  

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source sc/source

2013-06-04 Thread Noel Power
 include/oox/ole/vbaproject.hxx   |   11 +++
 oox/source/ole/axcontrol.cxx |   10 +--
 oox/source/ole/vbaproject.cxx|   79 ---
 sc/source/filter/oox/numberformatsbuffer.cxx |6 +-
 sc/source/filter/oox/stylesbuffer.cxx|5 -
 sc/source/filter/oox/workbookfragment.cxx|   23 ---
 sc/source/filter/oox/workbookhelper.cxx  |2 
 sc/source/ui/unoobj/servuno.cxx  |2 
 8 files changed, 85 insertions(+), 53 deletions(-)

New commits:
commit 25bb9d13b259dbfb73f1412506f0d051b3670089
Author: Noel Power noel.po...@suse.com
Date:   Tue Jun 4 15:24:29 2013 +0100

fix for fdo#53042 fix ole object macro bindings ( for xlsm )

A number of fixes needed here
a) make sure convert properties of control model is done before inserting
control model into formcontainer, need to do that to ensure that
GenerateVBAEvents is set ( so the fake VBA event generation can be
triggered )
b) remove the IsAlieanExcel check in servuno.cxx ( it's too strict and
additionally seems there is confusion over the media type to check )
c) split the vba import so that we can ensure the VBA mode is set (if
we have modules to import ) before sheets are imported and defer further
processing ( actual assigning of the modules and associated objects )
until later

Change-Id: I8fdbe788b400d7e41d4cc4b51b15f692bd7b0ecc

diff --git a/include/oox/ole/vbaproject.hxx b/include/oox/ole/vbaproject.hxx
index f742138..55ac3a8 100644
--- a/include/oox/ole/vbaproject.hxx
+++ b/include/oox/ole/vbaproject.hxx
@@ -25,6 +25,7 @@
 #include oox/helper/refvector.hxx
 #include oox/helper/storagebase.hxx
 #include oox/dllapi.h
+#include oox/ole/vbamodule.hxx
 
 namespace com { namespace sun { namespace star {
 namespace container { class XNameContainer; }
@@ -126,7 +127,12 @@ public:
 boolimportVbaProject(
 StorageBase rVbaPrjStrg );
 
-/** Registers a macro atatcher object. For details, see description of the
+/** Reads vba module related information from the project streams */
+voidreadVbaModules( StorageBase rVbaPrjStrg );
+/** Imports (and creates) vba modules and user forms from the vba project 
records previously read.
+  Note: ( expects that readVbaModules was already called ) */
+voidimportModulesAndForms( StorageBase rVbaPrjStrg, const 
GraphicHelper rGraphicHelper, bool bDefaultColorBgr = true );
+/** Registers a macro attacher object. For details, see description of the
 VbaMacroAttacherBase class. */
 voidregisterMacroAttacher( const VbaMacroAttacherRef 
rxAttacher );
 
@@ -194,6 +200,9 @@ private:
 OUString maPrjName;  /// Name of the VBA project.
 ::com::sun::star::uno::Reference 
::com::sun::star::container::XNameContainer 
 mxOleOverridesSink;
+typedef RefMap rtl::OUString, VbaModule  VbaModuleMap;
+VbaModuleMap maModules;
+VbaModuleMap maModulesByStrm;
 };
 
 // 
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index d5303a4..23f08e3 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -2704,6 +2704,7 @@ EmbeddedForm::EmbeddedForm( const Reference XModel  
rxDocModel,
 
 Reference XControlModel  EmbeddedForm::convertAndInsert( const 
EmbeddedControl rControl, sal_Int32 rnCtrlIndex )
 {
+Reference XControlModel  xRet;
 if( mxModelFactory.is()  rControl.hasModel() ) try
 {
 // create the UNO control model
@@ -2711,20 +2712,19 @@ Reference XControlModel  
EmbeddedForm::convertAndInsert( const EmbeddedControl
 Reference XFormComponent  xFormComp( mxModelFactory-createInstance( 
aServiceName ), UNO_QUERY_THROW );
 Reference XControlModel  xCtrlModel( xFormComp, UNO_QUERY_THROW );
 
+// convert the control properties
+if( rControl.convertProperties( xCtrlModel, maControlConv ) )
+xRet = xCtrlModel;
 // insert the control into the form
 Reference XIndexContainer  xFormIC( createXForm(), UNO_SET_THROW );
 rnCtrlIndex = xFormIC-getCount();
 xFormIC-insertByIndex( rnCtrlIndex, Any( xFormComp ) );
-
-// convert the control properties
-if( rControl.convertProperties( xCtrlModel, maControlConv ) )
-return xCtrlModel;
 }
 catch (const Exception e)
 {
 SAL_WARN(oox, exception creating Control:   e.Message);
 }
-return Reference XControlModel ();
+return xRet;
 }
 
 Reference XIndexContainer  EmbeddedForm::createXForm()
diff --git a/oox/source/ole/vbaproject.cxx b/oox/source/ole/vbaproject.cxx
index 91be356..b58710d 100644
--- a/oox/source/ole/vbaproject.cxx
+++ b/oox/source/ole/vbaproject.cxx
@@ -264,8 +264,14 @@ Reference XNameContainer  

[Libreoffice-commits] core.git: 2 commits - include/oox oox/source

2013-06-02 Thread Xisco Fauli
 include/oox/drawingml/table/tableproperties.hxx |2 
 oox/source/drawingml/table/tableproperties.cxx  |  146 +++-
 2 files changed, 145 insertions(+), 3 deletions(-)

New commits:
commit 355329a3cdbd8e4f2b7c6032ba0538a9a2a13d86
Author: Xisco Fauli aniste...@gmail.com
Date:   Sun Jun 2 23:58:27 2013 +0200

Don't merge this file

Change-Id: I5efca8bf4969252198e06ac3309064e8d69c0e55

diff --git a/oox/inc/oox/drawingml/table/tableproperties.hxx 
b/oox/inc/oox/drawingml/table/tableproperties.hxx
deleted file mode 100644
index 2928966..000
--- a/oox/inc/oox/drawingml/table/tableproperties.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- *
- * 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
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-
-
-#ifndef OOX_DRAWINGML_TABLEPROPERTIES_HXX
-#define OOX_DRAWINGML_TABLEPROPERTIES_HXX
-
-#include oox/drawingml/table/tablerow.hxx
-#include oox/drawingml/table/tablestyle.hxx
-#include oox/helper/propertymap.hxx
-#include oox/drawingml/color.hxx
-
-#include boost/shared_ptr.hpp
-#include boost/optional.hpp
-#include vector
-#include map
-
-namespace oox { namespace drawingml { namespace table {
-
-class TableProperties
-{
-public:
-
-TableProperties();
-~TableProperties();
-
-std::vector sal_Int32  getTableGrid() { return mvTableGrid; };
-std::vector TableRow  getTableRows() { return mvTableRows; };
-
-rtl::OUString  getStyleId(){ return maStyleId; };
-boost::shared_ptr TableStyle getTableStyle(){ return mpTableStyle; 
};
-sal_Bool   isRtl(){ return mbRtl; };
-sal_Bool   isFirstRow(){ return mbFirstRow; };
-sal_Bool   isFirstCol(){ return mbFirstCol; };
-sal_Bool   isLastRow(){ return mbLastRow; };
-sal_Bool   isLastCol(){ return mbLastCol; };
-sal_Bool   isBandRow(){ return mbBandRow; };
-sal_Bool   isBandCol(){ return mbBandCol; };
-
-void apply( const TablePropertiesPtr );
-void pushToPropSet( const ::oox::core::XmlFilterBase rFilterBase,
-const ::com::sun::star::uno::Reference  
::com::sun::star::beans::XPropertySet   xPropSet, 
::oox::drawingml::TextListStylePtr pMasterTextListStyle );
-
-private:
-
-const TableStyle   getUsedTableStyle( const 
::oox::core::XmlFilterBase rFilterBase, sal_Bool isCreateTabStyle);
-
-rtl::OUString   maStyleId;  // either 
StyleId is available
-boost::shared_ptr TableStyle  mpTableStyle;   // or the 
complete TableStyle
-std::vector sal_Int32 mvTableGrid;
-std::vector TableRow  mvTableRows;
-
-sal_BoolmbRtl;
-sal_BoolmbFirstRow;
-sal_BoolmbFirstCol;
-sal_BoolmbLastRow;
-sal_BoolmbLastCol;
-sal_BoolmbBandRow;
-sal_BoolmbBandCol;
-};
-
-} } }
-
-#endif  //  OOX_DRAWINGML_TABLEPROPERTIES_HXX
commit f39f7ba614749d99362a2059919521eee6bdb6fc
Author: Zhe Wang wangz...@apache.org
Date:   Fri Sep 7 03:49:09 2012 +

Fix issue #i120723#: Table style is lost when import PPTX by AOO

* subversion/main/oox/inc/oox/drawingml/table/tableproperties.hxx
* subversion/main/oox/source/drawingml/table/tableproperties.cxx
[]if the imported table in pptx just have tableStyleId, should fill the 
tablestyle's content.

Patch by: Ma Bingbing jiaz...@gmail.com
Suggested by: Wang Zhe kingwise...@gmail.com
Found by:Ma Bingbing jiaz...@gmail.com
Review by: Wang Zhe kingwise...@gmail.com(cherry picked from commit 
74b1435a4d39eac71e36fb1c387b24af4b353fa0)

Conflicts:
oox/inc/oox/drawingml/table/tableproperties.hxx
oox/source/drawingml/table/tableproperties.cxx

Change-Id: I554169522a95343662781c3f169c6485c38a6800

diff --git