[Libreoffice-commits] core.git: editeng/source sd/qa

2021-08-09 Thread Miklos Vajna (via logerrit)
 editeng/source/editeng/editeng.cxx |4 +-
 editeng/source/editeng/editundo.cxx|   11 +-
 editeng/source/editeng/editundo.hxx|3 +
 editeng/source/editeng/impedit.hxx |2 -
 editeng/source/editeng/impedit5.cxx|3 +
 sd/qa/unit/tiledrendering/data/paste-undo.fodp |   34 
 sd/qa/unit/tiledrendering/tiledrendering.cxx   |   41 +
 7 files changed, 93 insertions(+), 5 deletions(-)

New commits:
commit fc4c0747e97bb997cc37263b3e86b07dab21fe25
Author: Miklos Vajna 
AuthorDate: Mon Aug 9 19:20:53 2021 +0200
Commit: Miklos Vajna 
CommitDate: Tue Aug 10 07:43:46 2021 +0200

tdf#142845 editeng: don't update selection when formatting before sd paste

Regression from commit f0c25c751cf8e166a84b289746bce6202a40391d
(tdf#115783 sd: fix lost char attributes during in-table copy,
2018-02-16), the problem was that the formatting before paste also
created an undo action, and executing it alters the selection, which was
not intended.

So in case the textbox contains "world" and we paste "hello", then the
undo will set the cursor at the end of "world", while the expected
result is to just undo the paste and the formatting of "world".

Fix the problem by not altering the selection in the undo of
Outliner::SetCharAttribs(), which is only called by sd/ in the
before-paste case, not anywhere else.

Change-Id: Ie4a08f57d22cd1862c02987a5f86089fda8a5d9d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120220
Tested-by: Jenkins
Reviewed-by: Miklos Vajna 

diff --git a/editeng/source/editeng/editeng.cxx 
b/editeng/source/editeng/editeng.cxx
index abc9f64a9b04..c9aec527b222 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1768,7 +1768,9 @@ const SfxPoolItem& EditEngine::GetParaAttrib( sal_Int32 
nPara, sal_uInt16 nWhich
 void EditEngine::SetCharAttribs(sal_Int32 nPara, const SfxItemSet& rSet)
 {
 EditSelection aSel(pImpEditEngine->ConvertSelection(nPara, 0, nPara, 
GetTextLen(nPara)));
-pImpEditEngine->SetAttribs(aSel, rSet);
+// This is called by sd::View::OnBeginPasteOrDrop(), updating the cursor 
position on undo is not
+// wanted.
+pImpEditEngine->SetAttribs(aSel, rSet, /*nSpecial=*/SetAttribsMode::NONE, 
/*bSetSelection=*/false);
 pImpEditEngine->FormatAndUpdate();
 }
 
diff --git a/editeng/source/editeng/editundo.cxx 
b/editeng/source/editeng/editundo.cxx
index 714dd1b682ed..892183f754af 100644
--- a/editeng/source/editeng/editundo.cxx
+++ b/editeng/source/editeng/editundo.cxx
@@ -501,6 +501,7 @@ EditUndoSetAttribs::EditUndoSetAttribs(EditEngine* pEE, 
const ESelection& rESel,
 aESel(rESel),
 aNewAttribs(rNewItems),
 nSpecial(SetAttribsMode::NONE),
+m_bSetSelection(true),
 // When EditUndoSetAttribs actually is a RemoveAttribs this could be
 // recognize by the empty itemset, but then it would have to be caught in
 // its own place, which possible a setAttribs does with an empty itemset.
@@ -560,7 +561,10 @@ void EditUndoSetAttribs::Undo()
 }
 if ( bFields )
 pEE->UpdateFieldsOnly();
-ImpSetSelection();
+if (m_bSetSelection)
+{
+ImpSetSelection();
+}
 }
 
 void EditUndoSetAttribs::Redo()
@@ -574,7 +578,10 @@ void EditUndoSetAttribs::Redo()
 else
 pEE->RemoveCharAttribs( aSel, bRemoveParaAttribs, nRemoveWhich );
 
-ImpSetSelection();
+if (m_bSetSelection)
+{
+ImpSetSelection();
+}
 }
 
 void EditUndoSetAttribs::AppendContentInfo(ContentAttribsInfo* pNew)
diff --git a/editeng/source/editeng/editundo.hxx 
b/editeng/source/editeng/editundo.hxx
index 43d2a0d3b911..f87180ba7dd7 100644
--- a/editeng/source/editeng/editundo.hxx
+++ b/editeng/source/editeng/editundo.hxx
@@ -218,6 +218,8 @@ private:
 InfoArrayType   aPrevAttribs;
 
 SetAttribsMode  nSpecial;
+/// Once the attributes are set / unset, set the selection to the end of 
the formatted range?
+bool m_bSetSelection;
 boolbSetIsRemove;
 boolbRemoveParaAttribs;
 sal_uInt16  nRemoveWhich;
@@ -232,6 +234,7 @@ public:
 SfxItemSet& GetNewAttribs() { return aNewAttribs; }
 
 voidSetSpecial( SetAttribsMode n )  { nSpecial = n; }
+voidSetUpdateSelection( bool bSetSelection )  { 
m_bSetSelection = bSetSelection; }
 voidSetRemoveAttribs( bool b )  { bSetIsRemove = b; }
 voidSetRemoveParaAttribs( bool b )  { bRemoveParaAttribs = 
b; }
 voidSetRemoveWhich( sal_uInt16 n )  { nRemoveWhich = n; }
diff --git a/editeng/source/editeng/impedit.hxx 
b/editeng/source/editeng/impedit.hxx
index 78b2f85f9cc7..e138fa532f32 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -910,7 +910,7 @@ public:

[Libreoffice-commits] core.git: editeng/source sd/qa

2021-06-21 Thread Gülşah Köse (via logerrit)
 editeng/source/uno/unotext.cxx  |   14 +++---
 sd/qa/unit/data/pptx/tdf142716.pptx |binary
 sd/qa/unit/export-tests.cxx |   18 ++
 3 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit e837f50313a703b6b26abb78f224472c1e4734ea
Author: Gülşah Köse 
AuthorDate: Fri Jun 18 11:23:41 2021 +0300
Commit: Gülşah Köse 
CommitDate: Mon Jun 21 10:27:24 2021 +0200

tdf#142716 Update selection after any text is inserted.

When we don't update the selection after insertion of new text
SvxUnoTextBase::createEnumeration knows old selection and losts last part
of the text.

Change-Id: I20f6530f34097ff213ff00cff617139887fd287a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117409
Tested-by: Jenkins
Reviewed-by: Gülşah Köse 

diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 20d901e0d300..cae30b9eaa99 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1739,13 +1739,6 @@ void SAL_CALL SvxUnoTextBase::insertString( const 
uno::Reference< text::XTextRan
 if( !xRange.is() )
 return;
 
-if (GetEditSource())
-{
-ESelection aSelection;
-::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
-SetSelection( aSelection );
-}
-
 SvxUnoTextRangeBase* pRange = 
comphelper::getUnoTunnelImplementation( xRange );
 if(!pRange)
 return;
@@ -1761,6 +1754,13 @@ void SAL_CALL SvxUnoTextBase::insertString( const 
uno::Reference< text::XTextRan
 pRange->setString( aString );
 
 pRange->CollapseToEnd();
+
+if (GetEditSource())
+{
+ESelection aSelection;
+::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
+SetSelection( aSelection );
+}
 }
 
 void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< 
text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
diff --git a/sd/qa/unit/data/pptx/tdf142716.pptx 
b/sd/qa/unit/data/pptx/tdf142716.pptx
new file mode 100644
index ..4ef29e389449
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf142716.pptx differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 7805b591b6ed..c44564e201de 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -66,6 +66,7 @@ public:
 void testImageWithSpecialID();
 void testTdf62176();
 void testTransparentBackground();
+void testTdf142716();
 void testEmbeddedPdf();
 void testEmbeddedText();
 void testTransparenText();
@@ -110,6 +111,7 @@ public:
 CPPUNIT_TEST(testImageWithSpecialID);
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
+CPPUNIT_TEST(testTdf142716);
 CPPUNIT_TEST(testEmbeddedPdf);
 CPPUNIT_TEST(testEmbeddedText);
 CPPUNIT_TEST(testTransparenText);
@@ -287,6 +289,22 @@ void SdExportTest::testTransparentBackground()
 xDocShRef->DoClose();
 }
 
+void SdExportTest::testTdf142716()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf142716.pptx"), 
PPTX);
+xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+
+const SdrPage *pPage = GetPage( 1, xDocShRef );
+const SdrTextObj *pObj = dynamic_cast( pPage->GetObj( 0 ) );
+
+OUString sText = pObj->GetOutlinerParaObject()->GetTextObject().GetText(0);
+
+// Without fix "yyy" part will be lost.
+CPPUNIT_ASSERT_EQUAL( OUString( "xxx and yyy" ), sText);
+
+xDocShRef->DoClose();
+}
+
 void SdExportTest::testMediaEmbedding()
 {
 ::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/media_embedding.odp"), 
ODP);
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: editeng/source sd/qa

2020-03-03 Thread Justin Luth (via logerrit)
 editeng/source/editeng/editattr.cxx |4 
 editeng/source/editeng/editdoc.cxx  |4 
 editeng/source/editeng/impedit4.cxx |4 
 sd/qa/unit/data/tdf80194_defaultSubscripts.fodg |  407 
 sd/qa/unit/export-tests.cxx |   17 +
 5 files changed, 430 insertions(+), 6 deletions(-)

New commits:
commit 2940d1905b921d9909b08b1e32014d3c44474ef0
Author: Justin Luth 
AuthorDate: Mon Feb 17 20:20:31 2020 +0300
Commit: Samuel Mehrbrodt 
CommitDate: Tue Mar 3 16:20:03 2020 +0100

tdf#80194 editeng: fix auto subscript calculations

...and auto superscript too (although not as noticably).

THIS WILL CHANGE THE POSITION OF EDITENG SUBSCRIPTS
AND SUPERSCRIPTS IN EXISTING DOCUMENTS!
That is because they were very poorly placed
before - using a formula that is very different
from how Writer does it. Everyone in the bug reports
indicates that Writer does it good, but Impress
does it really bad. (tdf#89849, tdf#63083)

FOR EXAMPLE, when the char-size is reduced to
the default OF 58%, it will now be raised by 33%, not 42%.
Likewise, the subscript will now be lowered by 8%, not 42%.

THIS AFFECTS/FIXES Writer textboxes, Calc, Draw/Impress.

"Automatic" indicates that there is not a
"correct" answer, but that the computer should make
it "look good", so the user should be able to accept
this change in positioning, as long as it looks good.

The number of documents affected might be less than
one would expect. By default .uno:SuperScript
does NOT set auto mode (although Format-Character does).
Since most people would use the toolbar instead of the
format menu to create a superscript, auto will be rare.
So there will be relatively few cases where
subscripts are automatic in editeng, especially since
it looks so poor that most people probably turned
automatic off...

This patch has no effect on non-automatic escapement.

It uses the same fomula that calculated DFLT_ESC_SUB
(since it isn't an arbitrarily chosen value).
This is an approximation of the formula that Writer
uses (since Writer does exact calculations based
on each font's metrics).
This Writer-inspired formula was introduced in LO 6.4
for more accurate exporting to MSO
word processing formats (tdf#127316).

Change-Id: I0267810efe31a2b3be41bf2d39e2278ce9bc99e9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88911
Tested-by: Jenkins
Reviewed-by: Ilmari Lauhakangas 
Reviewed-by: Justin Luth 

diff --git a/editeng/source/editeng/editattr.cxx 
b/editeng/source/editeng/editattr.cxx
index f000cf793560..a99e4d496f74 100644
--- a/editeng/source/editeng/editattr.cxx
+++ b/editeng/source/editeng/editattr.cxx
@@ -273,9 +273,9 @@ void EditCharAttribEscapement::SetFont( SvxFont& rFont, 
OutputDevice* )
 
 short nEsc = static_cast(GetItem())->GetEsc();
 if ( nEsc == DFLT_ESC_AUTO_SUPER )
-nEsc = 100 - nProp;
+nEsc =  .8 * (100 - nProp);
 else if ( nEsc == DFLT_ESC_AUTO_SUB )
-nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
+nEsc =  .2 * -(100 - nProp);
 rFont.SetEscapement( nEsc );
 }
 
diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index f3f55edf60c1..42fc1f3cc22c 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -2008,9 +2008,9 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, 
bool bSearchInParent, S
 
 short nEsc = rEsc.GetEsc();
 if ( nEsc == DFLT_ESC_AUTO_SUPER )
-nEsc = 100 - nProp;
+nEsc = .8 * (100 - nProp);
 else if ( nEsc == DFLT_ESC_AUTO_SUB )
-nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
+nEsc = .2 * -(100 - nProp);
 rFont.SetEscapement( nEsc );
 }
 if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_PAIRKERNING ) == 
SfxItemState::SET ) )
diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index 67e924653618..25d7ecc0aa8a 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -930,12 +930,12 @@ void ImpEditEngine::WriteItemAsRTF( const SfxPoolItem& 
rItem, SvStream& rOutput,
 short nEsc = static_cast(rItem).GetEsc();
 if ( nEsc == DFLT_ESC_AUTO_SUPER )
 {
-nEsc = 100 - nProp;
+nEsc =  .8 * (100 - nProp);
 nProp100++; // A 1 afterwards means 'automatic'.
 }
 else if ( nEsc == DFLT_ESC_AUTO_SUB )
 {
-nEsc = sal::static_int_cast< short >( -( 100 - nProp ) );
+nEsc =  .2 * -(100 - nProp);
 nProp100++;
 }
 // SWG:
diff --git a/sd/qa/unit/data/tdf80194_defaultSubscripts.fodg 

[Libreoffice-commits] core.git: editeng/source sd/qa

2020-01-23 Thread Katarina Behrens (via logerrit)
 editeng/source/editeng/impedit2.cxx  |6 --
 editeng/source/xml/xmltxtimp.cxx |5 -
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   14 ++
 3 files changed, 18 insertions(+), 7 deletions(-)

New commits:
commit 66ed51712bb323bba7d1a0b0d21b256e5f5f9ccf
Author: Katarina Behrens 
AuthorDate: Fri Jan 17 14:30:56 2020 +0100
Commit: Katarina Behrens 
CommitDate: Thu Jan 23 15:01:33 2020 +0100

tdf#128046: preserve list levels on paste

done in two steps:
1) bullet and numbering properties must be included in the property
list of SvxUnoText on import from ODF clipboard (SvxReadXML)
2) in ConnectParagraphs, don't merge para attributes if the paragraph
to be deleted is empty. Paragraph breaks are inserted before paste so
this would make the last list level of the pasted text take the properties
of the empty paragraph and thus lose its indentation

Also updated tdf#103083 unit test to be more specific and test that
bullet properties don't get lost after paste. Previously only count
of SfxItems was tested which is somehow fragile and fails bc paste
adds a paragraph style

Change-Id: Ia162adb7abf145a8217f21c7ebfe06b69731e2a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86983
Tested-by: Jenkins
Reviewed-by: Katarina Behrens 

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 64c9f10f5135..30e12bec9a56 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2232,7 +2232,9 @@ EditPaM ImpEditEngine::ImpConnectParagraphs( ContentNode* 
pLeft, ContentNode* pR
 if ( bBackward )
 {
 pLeft->SetStyleSheet( pRight->GetStyleSheet() );
-pLeft->GetContentAttribs().GetItems().Set( 
pRight->GetContentAttribs().GetItems() );
+// it feels wrong to set pLeft's attribs if pRight is empty, tdf#128046
+if ( pRight->Len() )
+pLeft->GetContentAttribs().GetItems().Set( 
pRight->GetContentAttribs().GetItems() );
 pLeft->GetCharAttribs().GetDefFont() = 
pRight->GetCharAttribs().GetDefFont();
 }
 
@@ -3489,7 +3491,7 @@ uno::Reference< datatransfer::XTransferable > 
ImpEditEngine::CreateTransferable(
 std::filebuf afilebuf;
 afilebuf.open ("gsoc17_clipboard_test.xml",std::ios::out);
 std::ostream os();
-os.write((const char*)(pDataObj->GetODFStream().GetBuffer()), 
pDataObj->GetODFStream().remainingSize());
+os.write((const char*)(pDataObj->GetODFStream().GetData()), 
pDataObj->GetODFStream().remainingSize());
 afilebuf.close();
 */
 //dumping ends
diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx
index acd86b77cfee..f0bb5d171ceb 100644
--- a/editeng/source/xml/xmltxtimp.cxx
+++ b/editeng/source/xml/xmltxtimp.cxx
@@ -138,7 +138,10 @@ EditPaM SvxReadXML( EditEngine& rEditEngine, SvStream& 
rStream, const ESelection
 {
 SVX_UNOEDIT_CHAR_PROPERTIES,
 SVX_UNOEDIT_FONT_PROPERTIES,
-//  SVX_UNOEDIT_OUTLINER_PROPERTIES,
+//  bullets & numbering props, tdf#128046
+{ OUString(UNO_NAME_NUMBERING_RULES),EE_PARA_NUMBULLET,  
cppu::UnoType::get(), 0, 0 },
+{ OUString(UNO_NAME_NUMBERING),  
EE_PARA_BULLETSTATE,cppu::UnoType::get(), 0, 0 },
+{ OUString(UNO_NAME_NUMBERING_LEVEL),EE_PARA_OUTLLEVEL,  
::cppu::UnoType::get(), 0, 0 },
 SVX_UNOEDIT_PARA_PROPERTIES,
 { OUString(), 0, css::uno::Type(), 0, 0 }
 };
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 1e40d9645627..2fe192f66de9 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1428,8 +1429,9 @@ void SdTiledRenderingTest::testTdf103083()
 SdrOutliner* pOutliner = pView->GetTextEditOutliner();
 CPPUNIT_ASSERT_EQUAL(OUString("No-Logo Content~LT~Gliederung 2"),
  pOutliner->GetStyleSheet(2)->GetName());
-const SfxItemSet& rParagraphItemSet1 = 
pTextObject->GetOutlinerParaObject()->GetTextObject().GetParaAttribs(2);
-CPPUNIT_ASSERT_EQUAL(sal_uInt16(3), rParagraphItemSet1.Count());
+const EditTextObject& aEdit = 
pTextObject->GetOutlinerParaObject()->GetTextObject();
+const SvxNumBulletItem* pNumFmt = 
aEdit.GetParaAttribs(2).GetItem(EE_PARA_NUMBULLET);
+SvxNumberFormat aNumFmt(pNumFmt->GetNumRule()->GetLevel(2));
 
 // cut contents of bullet item
 comphelper::dispatchCommand(".uno:Cut", 
uno::Sequence());
@@ -1456,8 +1458,12 @@ void SdTiledRenderingTest::testTdf103083()
 CPPUNIT_ASSERT_EQUAL(OUString("No-Logo Content~LT~Gliederung 2"),
  pOutliner->GetStyleSheet(2)->GetName());
 
-const SfxItemSet& rParagraphItemSet2 = 

[Libreoffice-commits] core.git: editeng/source sd/qa

2018-02-25 Thread Tamás Zolnai
 editeng/source/editeng/impedit.cxx  |3 +
 sd/qa/unit/tiledrendering/data/cut_selection_change.odp |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx|   47 
 3 files changed, 50 insertions(+)

New commits:
commit 56629f9797fa1cf8b7c86b93ee2ea62673444c94
Author: Tamás Zolnai 
Date:   Sat Feb 24 04:44:20 2018 +0100

sd lok: Delete selection highlight after cutting text.

Call drawing also after the new selection is set, similar to
other cases where DrawSelectionXOR() is called before and after
selection change.
In desktop LO drawing is always called again and again by timeout,
so there the selection is updated anyway, while in LO online painting
does not emit a notification.

Change-Id: I6e9337fc0cfb61656387ba44d901521c3dfa60dd
Reviewed-on: https://gerrit.libreoffice.org/50268
Reviewed-by: Tamás Zolnai 
Tested-by: Tamás Zolnai 

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index 80566aaab1a0..dd21886c78e1 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1461,6 +1461,9 @@ void ImpEditView::DeleteSelected()
 pEditEngine->pImpEditEngine->UndoActionEnd();
 
 SetEditSelection( EditSelection( aPaM, aPaM ) );
+
+DrawSelectionXOR();
+
 pEditEngine->pImpEditEngine->FormatAndUpdate( GetEditViewPtr() );
 ShowCursor( DoAutoScroll(), true );
 }
diff --git a/sd/qa/unit/tiledrendering/data/cut_selection_change.odp 
b/sd/qa/unit/tiledrendering/data/cut_selection_change.odp
new file mode 100644
index ..19d3a18480e2
Binary files /dev/null and 
b/sd/qa/unit/tiledrendering/data/cut_selection_change.odp differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index 7c95dede1b90..9f4c94035674 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -114,6 +114,7 @@ public:
 void testPasteTextOnSlide();
 void testTdf115873();
 void testTdf115873Group();
+void testCutSelectionChange();
 
 CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
 CPPUNIT_TEST(testRegisterCallback);
@@ -159,6 +160,7 @@ public:
 CPPUNIT_TEST(testPasteTextOnSlide);
 CPPUNIT_TEST(testTdf115873);
 CPPUNIT_TEST(testTdf115873Group);
+CPPUNIT_TEST(testCutSelectionChange);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -2177,6 +2179,51 @@ void SdTiledRenderingTest::testTdf115873Group()
 CPPUNIT_ASSERT(pObjects->IsEqualToDoc(pXImpressDocument->GetDoc()));
 }
 
+void SdTiledRenderingTest::testCutSelectionChange()
+{
+// Load the document.
+comphelper::LibreOfficeKit::setActive();
+SdXImpressDocument* pXImpressDocument = 
createDoc("cut_selection_change.odp");
+CPPUNIT_ASSERT(pXImpressDocument);
+
+sd::ViewShell* pViewShell = 
pXImpressDocument->GetDocShell()->GetViewShell();
+
pViewShell->GetViewShellBase().registerLibreOfficeKitViewCallback(::callback,
 this);
+Scheduler::ProcessEventsToIdle();
+
+// Select first text object
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB);
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB);
+Scheduler::ProcessEventsToIdle();
+
+// step into text editing
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, '1', 0);
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, '1', 0);
+Scheduler::ProcessEventsToIdle();
+
+// select some text
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | 
KEY_SHIFT);
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | 
KEY_SHIFT);
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_LEFT | 
KEY_SHIFT);
+pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_LEFT | 
KEY_SHIFT);
+Scheduler::ProcessEventsToIdle();
+
+// Check that we have a selection before cutting
+CPPUNIT_ASSERT_EQUAL(static_cast(1), m_aSelection.size());
+
+// Cut the selected text
+comphelper::dispatchCommand(".uno:Cut", 
uno::Sequence());
+Scheduler::ProcessEventsToIdle();
+
+// Selection is removed
+CPPUNIT_ASSERT_EQUAL(static_cast(0), m_aSelection.size());
+
+utl::TempFile* pNewTempFile(new utl::TempFile);
+FileFormat* pFormat = getFormat(ODP);
+save(pXImpressDocument->GetDocShell(), pFormat, *pNewTempFile);
+
+comphelper::LibreOfficeKit::setActive(false);
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits


[Libreoffice-commits] core.git: editeng/source sd/qa sd/source

2017-10-14 Thread Henry Castro
 editeng/source/editeng/impedit5.cxx  |   10 +
 sd/qa/unit/tiledrendering/tiledrendering.cxx |   21 +++
 sd/source/ui/docshell/docshel3.cxx   |   17 +++--
 sd/source/ui/docshell/docshell.cxx   |   49 +--
 4 files changed, 91 insertions(+), 6 deletions(-)

New commits:
commit 59e9d163345e7a9eb68c1bae273593cd70c61153
Author: Henry Castro 
Date:   Fri Oct 13 20:47:29 2017 -0400

sd lok: fix spell checking languages in Impress

Change-Id: I133c9b91521fa7f2b5f7e3a47396f7efa31e1a86
Reviewed-on: https://gerrit.libreoffice.org/43382
Tested-by: Jenkins 
Reviewed-by: Henry Castro 

diff --git a/editeng/source/editeng/impedit5.cxx 
b/editeng/source/editeng/impedit5.cxx
index 5ba3549c9360..170bccec2676 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -684,6 +684,7 @@ void ImpEditEngine::RemoveCharAttribs( sal_Int32 nPara, 
sal_uInt16 nWhich, bool
 
 void ImpEditEngine::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rSet )
 {
+bool bCheckLanguage = false;
 ContentNode* pNode = aEditDoc.GetObject( nPara );
 
 if ( !pNode )
@@ -704,7 +705,16 @@ void ImpEditEngine::SetParaAttribs( sal_Int32 nPara, const 
SfxItemSet& rSet )
 InsertUndo(new EditUndoSetParaAttribs(pEditEngine, nPara, 
pNode->GetContentAttribs().GetItems(), rSet));
 }
 }
+
+bCheckLanguage = ( rSet.GetItemState( EE_CHAR_LANGUAGE ) == 
SfxItemState::SET ) ||
+ ( rSet.GetItemState( EE_CHAR_LANGUAGE_CJK ) == 
SfxItemState::SET ) ||
+ ( rSet.GetItemState( EE_CHAR_LANGUAGE_CTL ) == 
SfxItemState::SET );
+
 pNode->GetContentAttribs().GetItems().Set( rSet );
+
+if ( bCheckLanguage && pNode->GetWrongList() )
+pNode->GetWrongList()->ResetInvalidRange(0, pNode->Len());
+
 if ( aStatus.UseCharAttribs() )
 pNode->CreateDefFont();
 
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index c72b42a5ac5b..1e3d54e7e6d1 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -102,6 +103,7 @@ public:
 void testCommentCallbacks();
 void testMultiViewInsertDeletePage();
 void testDisableUndoRepair();
+void testLanguageStatus();
 
 CPPUNIT_TEST_SUITE(SdTiledRenderingTest);
 CPPUNIT_TEST(testRegisterCallback);
@@ -139,6 +141,7 @@ public:
 CPPUNIT_TEST(testCommentCallbacks);
 CPPUNIT_TEST(testMultiViewInsertDeletePage);
 CPPUNIT_TEST(testDisableUndoRepair);
+CPPUNIT_TEST(testLanguageStatus);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -1827,6 +1830,24 @@ void SdTiledRenderingTest::testDisableUndoRepair()
 }
 }
 
+void SdTiledRenderingTest::testLanguageStatus()
+{
+// Load the document.
+comphelper::LibreOfficeKit::setActive();
+createDoc("dummy.odp");
+SfxViewShell* pView1 = SfxViewShell::Current();
+SfxLokHelper::createView();
+SfxViewShell* pView2 = SfxViewShell::Current();
+{
+std::unique_ptr pItem1;
+std::unique_ptr pItem2;
+pView1->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, 
pItem1);
+pView2->GetViewFrame()->GetBindings().QueryState(SID_LANGUAGE_STATUS, 
pItem2);
+CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem1.get()));
+CPPUNIT_ASSERT(dynamic_cast< const SfxStringListItem* >(pItem2.get()));
+}
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdTiledRenderingTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sd/source/ui/docshell/docshel3.cxx 
b/sd/source/ui/docshell/docshel3.cxx
index db099f07ce45..463c2273ee00 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -120,7 +120,8 @@ static void lcl_setLanguage( const SdDrawDocument *pDoc, 
const OUString 
 for( size_t nObj = 0; nObj < nObjCount; ++nObj )
 {
 SdrObject *pObj = pPage->GetObj( nObj );
-lcl_setLanguageForObj( pObj, nLang, bLanguageNone );
+if (pObj->GetObjIdentifier() != OBJ_PAGE)
+lcl_setLanguageForObj( pObj, nLang, bLanguageNone );
 }
 }
 }
@@ -296,6 +297,7 @@ void DrawDocShell::Execute( SfxRequest& rReq )
 const OUString aDocumentLangPrefix("Default_");
 const OUString aStrNone("LANGUAGE_NONE");
 const OUString aStrResetLangs("RESET_LANGUAGES");
+SdDrawDocument* pDoc = mpViewShell->GetDoc();
 sal_Int32 nPos = -1;
 if (-1 != (nPos = aNewLangTxt.indexOf( 
aDocumentLangPrefix )))
 {
@@ -306,11 +308,18 @@ void DrawDocShell::Execute( SfxRequest& 

[Libreoffice-commits] core.git: editeng/source sd/qa xmloff/inc xmloff/source

2017-03-18 Thread Rosemary Sebastian
 editeng/source/items/flditem.cxx |   15 +--
 sd/qa/unit/data/odp/author_fixed.odp |binary
 sd/qa/unit/export-tests.cxx  |   19 +++
 xmloff/inc/txtfldi.hxx   |4 
 xmloff/source/text/txtflde.cxx   |7 +--
 xmloff/source/text/txtfldi.cxx   |   10 ++
 6 files changed, 47 insertions(+), 8 deletions(-)

New commits:
commit 109210e5b71a4e0b6fcaae72be7ef8d7667f3708
Author: Rosemary Sebastian 
Date:   Sat Mar 18 08:46:27 2017 +

Revert "Revert "Implement export and import of author field in fixed 
format""

This reverts commit cae16645e17df6a1f87443c00b6abfd26dabd27f.

Change-Id: If5b85beb53a0925909d537023879a7d86fa011cf
Reviewed-on: https://gerrit.libreoffice.org/35391
Tested-by: Jenkins 
Reviewed-by: Rosemary Sebastian 
Tested-by: Rosemary Sebastian 

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 1d5ba3fa784e..690425594227 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -181,13 +181,16 @@ SvxFieldData* SvxFieldData::Create(const 
uno::Reference& xTe
 SvxAuthorField* pData = new SvxAuthorField(
 aFirstName, aLastName, OUString(), bIsFixed ? 
SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
 
-if (!bFullName)
+if (!bIsFixed)
 {
-pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
-}
-else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
-{
-pData->SetFormat(static_cast(nFmt));
+if (!bFullName)
+{
+pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+}
+else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
+{
+
pData->SetFormat(static_cast(nFmt));
+}
 }
 
 return pData;
diff --git a/sd/qa/unit/data/odp/author_fixed.odp 
b/sd/qa/unit/data/odp/author_fixed.odp
new file mode 100644
index ..2e666ad17fee
Binary files /dev/null and b/sd/qa/unit/data/odp/author_fixed.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 797bf36d6192..dd57ec01bf3d 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -92,6 +92,7 @@ public:
 void testTdf62176();
 void testTransparentBackground();
 void testEmbeddedPdf();
+void testAuthorField();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -106,6 +107,7 @@ public:
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
 CPPUNIT_TEST(testEmbeddedPdf);
+CPPUNIT_TEST(testAuthorField);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -552,6 +554,23 @@ void SdExportTest::testEmbeddedPdf()
 #endif
 }
 
+void SdExportTest::testAuthorField()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), 
ODP);
+
+xDocShRef = saveAndReload( xDocShRef.get(), ODP );
+
+uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 
0, xDocShRef);
+CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+uno::Reference< beans::XPropertySet > xPropSet( xField, 
uno::UNO_QUERY_THROW );
+bool bFixed = false;
+xPropSet->getPropertyValue("IsFixed") >>= bFixed;
+CPPUNIT_ASSERT_MESSAGE("Author field is not fixed", bFixed);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 106545c34503..ed154c72ffe0 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -234,6 +234,10 @@ protected:
 virtual void StartElement(
 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) 
override;
 
+/// process attribute values
+virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+   const OUString& sAttrValue ) override;
+
 /// prepare XTextField for insertion into document
 virtual void PrepareField(
 const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) 
override;
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 4692856b96e2..91dba974616d 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1055,8 +1055,11 @@ void XMLTextFieldExport::ExportFieldHelper(
 switch (nToken) {
 case FIELD_ID_AUTHOR:
 // author field: fixed, field (sub-)type
-ProcessBoolean(XML_FIXED,
-   GetBoolProperty(sPropertyIsFixed, 

[Libreoffice-commits] core.git: editeng/source sd/qa xmloff/inc xmloff/source

2017-03-16 Thread Rosemary Sebastian
 dev/null |binary
 editeng/source/items/flditem.cxx |   15 ++-
 sd/qa/unit/export-tests.cxx  |   19 ---
 xmloff/inc/txtfldi.hxx   |4 
 xmloff/source/text/txtflde.cxx   |7 ++-
 xmloff/source/text/txtfldi.cxx   |   10 --
 6 files changed, 8 insertions(+), 47 deletions(-)

New commits:
commit cae16645e17df6a1f87443c00b6abfd26dabd27f
Author: Rosemary Sebastian 
Date:   Thu Mar 16 15:25:26 2017 +

Revert "Implement export and import of author field in fixed format"

This reverts commit 5de40734af30a8b897c6c5b7f681759e36a25557.

Change-Id: Ib09fb1dc54066cadcd9503c92140d78e7482ae6c
Reviewed-on: https://gerrit.libreoffice.org/35281
Reviewed-by: Rosemary Sebastian 
Tested-by: Rosemary Sebastian 

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 690425594227..1d5ba3fa784e 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -181,16 +181,13 @@ SvxFieldData* SvxFieldData::Create(const 
uno::Reference& xTe
 SvxAuthorField* pData = new SvxAuthorField(
 aFirstName, aLastName, OUString(), bIsFixed ? 
SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
 
-if (!bIsFixed)
+if (!bFullName)
 {
-if (!bFullName)
-{
-pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
-}
-else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
-{
-
pData->SetFormat(static_cast(nFmt));
-}
+pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+}
+else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
+{
+pData->SetFormat(static_cast(nFmt));
 }
 
 return pData;
diff --git a/sd/qa/unit/data/odp/author_fixed.odp 
b/sd/qa/unit/data/odp/author_fixed.odp
deleted file mode 100644
index 2e666ad17fee..
Binary files a/sd/qa/unit/data/odp/author_fixed.odp and /dev/null differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index dd57ec01bf3d..797bf36d6192 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -92,7 +92,6 @@ public:
 void testTdf62176();
 void testTransparentBackground();
 void testEmbeddedPdf();
-void testAuthorField();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -107,7 +106,6 @@ public:
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
 CPPUNIT_TEST(testEmbeddedPdf);
-CPPUNIT_TEST(testAuthorField);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -554,23 +552,6 @@ void SdExportTest::testEmbeddedPdf()
 #endif
 }
 
-void SdExportTest::testAuthorField()
-{
-::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), 
ODP);
-
-xDocShRef = saveAndReload( xDocShRef.get(), ODP );
-
-uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 
0, xDocShRef);
-CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
-
-uno::Reference< beans::XPropertySet > xPropSet( xField, 
uno::UNO_QUERY_THROW );
-bool bFixed = false;
-xPropSet->getPropertyValue("IsFixed") >>= bFixed;
-CPPUNIT_ASSERT_MESSAGE("Author field is not fixed", bFixed);
-
-xDocShRef->DoClose();
-}
-
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index ed154c72ffe0..106545c34503 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -234,10 +234,6 @@ protected:
 virtual void StartElement(
 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) 
override;
 
-/// process attribute values
-virtual void ProcessAttribute( sal_uInt16 nAttrToken,
-   const OUString& sAttrValue ) override;
-
 /// prepare XTextField for insertion into document
 virtual void PrepareField(
 const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) 
override;
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 91dba974616d..4692856b96e2 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1055,11 +1055,8 @@ void XMLTextFieldExport::ExportFieldHelper(
 switch (nToken) {
 case FIELD_ID_AUTHOR:
 // author field: fixed, field (sub-)type
-if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
-{
-GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FIXED,
- 

[Libreoffice-commits] core.git: editeng/source sd/qa xmloff/inc xmloff/source

2017-03-09 Thread Rosemary Sebastian
 editeng/source/items/flditem.cxx |   15 +--
 sd/qa/unit/data/odp/author_fixed.odp |binary
 sd/qa/unit/export-tests.cxx  |   19 +++
 xmloff/inc/txtfldi.hxx   |4 
 xmloff/source/text/txtflde.cxx   |7 +--
 xmloff/source/text/txtfldi.cxx   |   10 ++
 6 files changed, 47 insertions(+), 8 deletions(-)

New commits:
commit 5de40734af30a8b897c6c5b7f681759e36a25557
Author: Rosemary Sebastian 
Date:   Wed Jan 25 12:56:47 2017 +0530

Implement export and import of author field in fixed format

Change-Id: I1975bfcdc8436f2b05e2fab2a4c9c09838330b30
Reviewed-on: https://gerrit.libreoffice.org/33520
Tested-by: Jenkins 
Reviewed-by: Rosemary Sebastian 

diff --git a/editeng/source/items/flditem.cxx b/editeng/source/items/flditem.cxx
index 1d5ba3f..6904255 100644
--- a/editeng/source/items/flditem.cxx
+++ b/editeng/source/items/flditem.cxx
@@ -181,13 +181,16 @@ SvxFieldData* SvxFieldData::Create(const 
uno::Reference& xTe
 SvxAuthorField* pData = new SvxAuthorField(
 aFirstName, aLastName, OUString(), bIsFixed ? 
SVXAUTHORTYPE_FIX : SVXAUTHORTYPE_VAR);
 
-if (!bFullName)
+if (!bIsFixed)
 {
-pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
-}
-else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
-{
-pData->SetFormat(static_cast(nFmt));
+if (!bFullName)
+{
+pData->SetFormat(SVXAUTHORFORMAT_SHORTNAME);
+}
+else if (nFmt >= SVXAUTHORFORMAT_FULLNAME && nFmt <= 
SVXAUTHORFORMAT_SHORTNAME)
+{
+
pData->SetFormat(static_cast(nFmt));
+}
 }
 
 return pData;
diff --git a/sd/qa/unit/data/odp/author_fixed.odp 
b/sd/qa/unit/data/odp/author_fixed.odp
new file mode 100644
index 000..2e666ad
Binary files /dev/null and b/sd/qa/unit/data/odp/author_fixed.odp differ
diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx
index 797bf36..dd57ec0 100644
--- a/sd/qa/unit/export-tests.cxx
+++ b/sd/qa/unit/export-tests.cxx
@@ -92,6 +92,7 @@ public:
 void testTdf62176();
 void testTransparentBackground();
 void testEmbeddedPdf();
+void testAuthorField();
 
 CPPUNIT_TEST_SUITE(SdExportTest);
 
@@ -106,6 +107,7 @@ public:
 CPPUNIT_TEST(testTdf62176);
 CPPUNIT_TEST(testTransparentBackground);
 CPPUNIT_TEST(testEmbeddedPdf);
+CPPUNIT_TEST(testAuthorField);
 
 CPPUNIT_TEST_SUITE_END();
 
@@ -552,6 +554,23 @@ void SdExportTest::testEmbeddedPdf()
 #endif
 }
 
+void SdExportTest::testAuthorField()
+{
+::sd::DrawDocShellRef xDocShRef = 
loadURL(m_directories.getURLFromSrc("/sd/qa/unit/data/odp/author_fixed.odp"), 
ODP);
+
+xDocShRef = saveAndReload( xDocShRef.get(), ODP );
+
+uno::Reference< text::XTextField > xField = getTextFieldFromPage(0, 0, 0, 
0, xDocShRef);
+CPPUNIT_ASSERT_MESSAGE("Where is the text field?", xField.is() );
+
+uno::Reference< beans::XPropertySet > xPropSet( xField, 
uno::UNO_QUERY_THROW );
+bool bFixed = false;
+xPropSet->getPropertyValue("IsFixed") >>= bFixed;
+CPPUNIT_ASSERT_MESSAGE("Author field is not fixed", bFixed);
+
+xDocShRef->DoClose();
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SdExportTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/xmloff/inc/txtfldi.hxx b/xmloff/inc/txtfldi.hxx
index 106545c..ed154c7 100644
--- a/xmloff/inc/txtfldi.hxx
+++ b/xmloff/inc/txtfldi.hxx
@@ -234,6 +234,10 @@ protected:
 virtual void StartElement(
 const css::uno::Reference< css::xml::sax::XAttributeList> & xAttrList) 
override;
 
+/// process attribute values
+virtual void ProcessAttribute( sal_uInt16 nAttrToken,
+   const OUString& sAttrValue ) override;
+
 /// prepare XTextField for insertion into document
 virtual void PrepareField(
 const css::uno::Reference< css::beans::XPropertySet> & xPropertySet) 
override;
diff --git a/xmloff/source/text/txtflde.cxx b/xmloff/source/text/txtflde.cxx
index 4037bab..72dc79a 100644
--- a/xmloff/source/text/txtflde.cxx
+++ b/xmloff/source/text/txtflde.cxx
@@ -1067,8 +1067,11 @@ void XMLTextFieldExport::ExportFieldHelper(
 switch (nToken) {
 case FIELD_ID_AUTHOR:
 // author field: fixed, field (sub-)type
-ProcessBoolean(XML_FIXED,
-   GetBoolProperty(sPropertyIsFixed, rPropSet), true);
+if (xPropSetInfo->hasPropertyByName(sPropertyIsFixed))
+{
+GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_FIXED,
+ 

[Libreoffice-commits] core.git: editeng/source sd/qa

2014-06-24 Thread Matúš Kukan
 editeng/source/editeng/impedit3.cxx |4 ++--
 sd/qa/unit/data/xml/n593612_0.xml   |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

New commits:
commit 9388c45c0263a0090f9cb4be9c42b93b5f7985d0
Author: Matúš Kukan matus.ku...@collabora.com
Date:   Mon Jun 23 11:37:47 2014 +0200

bnc#882631: Do not hide top of the first row when editing text in table 
cells.

This can happen when proportional line spacing is less than 100%
and FontIndependentLineSpacing is set, so just keep the height
of the very first line in case of IsFixedCellHeight() too.

Change-Id: Id231fc1f2373645e5420f877e8c2568ce8a1f099

diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 2881a81..d717b1a 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -1340,7 +1340,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, 
sal_uInt32 nStartPosY )
 }
 else if ( rLSItem.GetInterLineSpaceRule() == 
SVX_INTER_LINE_SPACE_PROP )
 {
-if ( nPara || IsFixedCellHeight() || pLine-GetStartPortion() 
) // Not the very first line
+if ( nPara || pLine-GetStartPortion() ) // Not the very first 
line
 {
 // There are documents with PropLineSpace 0, why?
 // (cmc: re above question :-) such documents can be seen 
by importing a .ppt
@@ -1670,7 +1670,7 @@ void ImpEditEngine::CreateAndInsertEmptyLine( 
ParaPortion* pParaPortion, sal_uIn
 else if ( rLSItem.GetInterLineSpaceRule() == SVX_INTER_LINE_SPACE_PROP 
)
 {
 sal_Int32 nPara = GetParaPortions().GetPos( pParaPortion );
-if ( nPara || IsFixedCellHeight() || pTmpLine-GetStartPortion() ) 
// Not the very first line
+if ( nPara || pTmpLine-GetStartPortion() ) // Not the very first 
line
 {
 // There are documents with PropLineSpace 0, why?
 // (cmc: re above question :-) such documents can be seen by 
importing a .ppt
diff --git a/sd/qa/unit/data/xml/n593612_0.xml 
b/sd/qa/unit/data/xml/n593612_0.xml
index 5d5189b..5d03e58 100644
--- a/sd/qa/unit/data/xml/n593612_0.xml
+++ b/sd/qa/unit/data/xml/n593612_0.xml
@@ -1,6 +1,6 @@
 ?xml version=1.0?
 XShapes
- XShape positionX=11429 positionY=1324 sizeX=2259 sizeY=15192 
type=com.sun.star.drawing.CustomShape name=Rectangle 52 
text=#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;
 fontHeight=24.00 fontColor= textAutoGrowHeight=true 
textAutoGrowWidth=false textContourFrame=false textFitToSize=NONE 
textHorizontalAdjust=CENTER textVerticalAdjust=TOP textLeftDistance=254 
textRightDistance=254 textUpperDistance=127 textLowerDistance=127 
textMaximumFrameHeight=0 textMaximumFrameWidth=0 textMinimumFrameHeight=0 
textMinimumFrameWidth=0 textAnimationAmount=0 textAnimationCount=0 
textAnimationDelay=0 textAnimationDirection=LEFT textAnimationKind=NONE 
textAnimationStartInside=false textAnimationStopInside=false 
textWritingMode=LR_TB fillStyle=SOLID fillColor=3c8c93 
fillTransparence=0 fillTran
 sparenceGradientName=
+ XShape positionX=11429 positionY=1324 sizeX=2259 sizeY=15209 
type=com.sun.star.drawing.CustomShape name=Rectangle 52 
text=#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;
 fontHeight=24.00 fontColor= textAutoGrowHeight=true 
textAutoGrowWidth=false textContourFrame=false textFitToSize=NONE 
textHorizontalAdjust=CENTER textVerticalAdjust=TOP textLeftDistance=254 
textRightDistance=254 textUpperDistance=127 textLowerDistance=127 
textMaximumFrameHeight=0 textMaximumFrameWidth=0 textMinimumFrameHeight=0 
textMinimumFrameWidth=0 textAnimationAmount=0 textAnimationCount=0 
textAnimationDelay=0 textAnimationDirection=LEFT textAnimationKind=NONE 
textAnimationStartInside=false textAnimationStopInside=false 
textWritingMode=LR_TB fillStyle=SOLID fillColor=3c8c93 
fillTransparence=0 fillTran
 sparenceGradientName=
   FillTransparenceGradient style=LINEAR startColor=00 
endColor=ff angle=0 border=0 xOffset=50 yOffset=50 
startIntensity=100 endIntensity=100 stepCount=0/
   FillGradient style=LINEAR startColor=3465a4 endColor=ff angle=0 
border=0 xOffset=50 yOffset=50 startIntensity=100 endIntensity=100 
stepCount=0/
   FillHatch style=SINGLE color=3465a4 distance=20 angle=0/
@@ -10,7 +10,7 @@
   LineEnd/
   Transformation
Line1 column1=2260.00 column2=0.00 column3=11429.00/
-   Line2 column1=0.00 column2=15193.00 column3=1324.00/
+   Line2 column1=0.00 column2=15210.00 column3=1324.00/
Line3 column1=0.00 column2=0.00 column3=1.00/
   /Transformation
   CustomShapeGeometry
___
Libreoffice-commits mailing 

[Libreoffice-commits] core.git: editeng/source sd/qa

2014-06-21 Thread Matúš Kukan
 editeng/source/editeng/impedit2.cxx |6 ++
 editeng/source/editeng/impedit3.cxx |7 ---
 sd/qa/unit/data/xml/n593612_0.xml   |4 ++--
 3 files changed, 4 insertions(+), 13 deletions(-)

New commits:
commit fc577e4f414b6fe838dff0163bceeea012c92de9
Author: Matúš Kukan matus.ku...@collabora.com
Date:   Fri Jun 20 14:18:09 2014 +0200

Revert bnc#882631: keep line visible if proportional line spacing is  
100%.

This reverts commit 339e5d44a2afa0f5309a970f1ff11968103e336a
and commit d1987a3eaccfc3add35e6b9f8307ede857c5468e
fix sd_import_tests after e42c05c1f96832572e525d85d89590f56f5a29dd.

It would need more work and understanding, so just revert.
Also, the problem with bnc#882631 is somewhere else, though this helped too.

diff --git a/editeng/source/editeng/impedit2.cxx 
b/editeng/source/editeng/impedit2.cxx
index 8cf1d74..3140c16 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4028,9 +4028,7 @@ void ImpEditEngine::CalcHeight( ParaPortion* pPortion )
 {
 OSL_ENSURE( pPortion-GetLines().Count(), Paragraph with no lines in 
ParaPortion::CalcHeight );
 for (sal_Int32 nLine = 0; nLine  pPortion-GetLines().Count(); 
++nLine)
-// Use GetTxtHeight() for first line, otherwise height is small
-// if the paragraph has proportional line spacing less than 100%.
-pPortion-nHeight += nLine ? 
pPortion-GetLines()[nLine]-GetHeight() : 
pPortion-GetLines()[nLine]-GetTxtHeight();
+pPortion-nHeight += pPortion-GetLines()[nLine]-GetHeight();
 
 if ( !aStatus.IsOutliner() )
 {
@@ -4173,7 +4171,7 @@ Rectangle ImpEditEngine::GetEditCursor( ParaPortion* 
pPortion, sal_Int32 nIndex,
 Rectangle aEditCursor;
 
 aEditCursor.Top() = nY;
-nY += pLine-GetTxtHeight();
+nY += pLine-GetHeight();
 aEditCursor.Bottom() = nY-1;
 
 // Search within the line...
diff --git a/editeng/source/editeng/impedit3.cxx 
b/editeng/source/editeng/impedit3.cxx
index 7678ef1..2881a81 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2924,13 +2924,6 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, 
Rectangle aClipRect, Point aSt
 aTmpPos.X() += pLine-GetStartPosX();
 aTmpPos.Y() += pLine-GetMaxAscent();
 aStartPos.Y() += pLine-GetHeight();
-if (nLine == 0)
-{
-// First line needs to be visible, so add more space 
if text height is bigger.
-const sal_Int32 nDiff = pLine-GetTxtHeight() - 
pLine-GetHeight();
-aTmpPos.Y() += nDiff;
-aStartPos.Y() += nDiff;
-}
 if (nLine != nLastLine)
 aStartPos.Y() += nVertLineSpacing;
 }
diff --git a/sd/qa/unit/data/xml/n593612_0.xml 
b/sd/qa/unit/data/xml/n593612_0.xml
index b55385b..5d5189b 100644
--- a/sd/qa/unit/data/xml/n593612_0.xml
+++ b/sd/qa/unit/data/xml/n593612_0.xml
@@ -1,6 +1,6 @@
 ?xml version=1.0?
 XShapes
- XShape positionX=11429 positionY=1324 sizeX=2259 sizeY=15821 
type=com.sun.star.drawing.CustomShape name=Rectangle 52 
text=#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;
 fontHeight=24.00 fontColor= textAutoGrowHeight=true 
textAutoGrowWidth=false textContourFrame=false textFitToSize=NONE 
textHorizontalAdjust=CENTER textVerticalAdjust=TOP textLeftDistance=254 
textRightDistance=254 textUpperDistance=127 textLowerDistance=127 
textMaximumFrameHeight=0 textMaximumFrameWidth=0 textMinimumFrameHeight=0 
textMinimumFrameWidth=0 textAnimationAmount=0 textAnimationCount=0 
textAnimationDelay=0 textAnimationDirection=LEFT textAnimationKind=NONE 
textAnimationStartInside=false textAnimationStopInside=false 
textWritingMode=LR_TB fillStyle=SOLID fillColor=3c8c93 
fillTransparence=0 fillTran
 sparenceGradientName=
+ XShape positionX=11429 positionY=1324 sizeX=2259 sizeY=15192 
type=com.sun.star.drawing.CustomShape name=Rectangle 52 
text=#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;#10;
 fontHeight=24.00 fontColor= textAutoGrowHeight=true 
textAutoGrowWidth=false textContourFrame=false textFitToSize=NONE 
textHorizontalAdjust=CENTER textVerticalAdjust=TOP textLeftDistance=254 
textRightDistance=254 textUpperDistance=127 textLowerDistance=127 
textMaximumFrameHeight=0 textMaximumFrameWidth=0 textMinimumFrameHeight=0 
textMinimumFrameWidth=0 textAnimationAmount=0 textAnimationCount=0 
textAnimationDelay=0 textAnimationDirection=LEFT textAnimationKind=NONE 
textAnimationStartInside=false textAnimationStopInside=false 
textWritingMode=LR_TB fillStyle=SOLID fillColor=3c8c93