[Libreoffice-commits] core.git: Branch 'libreoffice-4-4' - 3 commits - sc/source
Henry Castro
hcvcastro at gmail.com
Thu Mar 5 04:00:39 PST 2015
sc/source/ui/app/inputhdl.cxx | 8 ++
sc/source/ui/app/rfindlst.cxx | 52 +++++++++++--
sc/source/ui/inc/rfindlst.hxx | 2
sc/source/ui/view/output2.cxx | 4 +
sc/source/ui/view/viewfun3.cxx | 158 ++++++++++++++++++++++++-----------------
5 files changed, 155 insertions(+), 69 deletions(-)
New commits:
commit ce8aba4da2a287c2b51d1d34a290284b2f754dc2
Author: Henry Castro <hcvcastro at gmail.com>
Date: Mon Mar 2 21:39:53 2015 -0400
Resolves tdf#84012 FORMATTING: Partially missing text in shrink-to-fit cells
Change-Id: I32f44acbcf5a6aed4d9f7442ad7212af31073352
Reviewed-on: https://gerrit.libreoffice.org/14723
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 4acffa65b58c8bd359215345dca2c61e2c5ceba5)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index fc3535e..5fa3e29 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -1743,7 +1743,11 @@ void ScOutputData::DrawStrings( bool bPixelToLogic )
// If even at half the size the font still isn't rendered smaller,
// fall back to normal clipping (showing ### for numbers).
if ( nNewSize <= nAvailable )
+ {
+ // Reset relevant parameters.
aAreaParam.mbLeftClip = aAreaParam.mbRightClip = false;
+ aAreaParam.mnLeftClipLength = aAreaParam.mnRightClipLength = 0;
+ }
pOldPattern = NULL;
}
commit 36a808de7cb79e1c20c9e23d41b54a7c8399dcd3
Author: Henry Castro <hcvcastro at gmail.com>
Date: Wed Mar 4 17:26:05 2015 -0400
Resolves tdf#78221 Cannot drag twice the same cell when editing formula
Change-Id: I69402778e68a2955bdda1ba2c9d31d9b10fb60cc
Reviewed-on: https://gerrit.libreoffice.org/14748
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Andras Timar <andras.timar at collabora.com>
(cherry picked from commit 3381cb4a421bf390445b7dac9ea42f9ccaf3d875)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx
index 482a56f..c44257b 100644
--- a/sc/source/ui/app/inputhdl.cxx
+++ b/sc/source/ui/app/inputhdl.cxx
@@ -340,6 +340,7 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
ScRangeFindData* pData = pRangeFindList->GetObject( nIndex );
sal_Int32 nOldStart = pData->nSelStart;
sal_Int32 nOldEnd = pData->nSelEnd;
+ ColorData nNewColor = pRangeFindList->FindColor( rNew, nIndex );
ScRange aJustified = rNew;
aJustified.Justify(); // Always display Ref in the Formula the right way
@@ -347,11 +348,14 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
const ScAddress::Details aAddrDetails( pDoc, aCursorPos );
OUString aNewStr(aJustified.Format(pData->nFlags, pDoc, aAddrDetails));
ESelection aOldSel( 0, nOldStart, 0, nOldEnd );
+ SfxItemSet aSet( pEngine->GetEmptyItemSet() );
DataChanging();
lcl_Replace( pTopView, aNewStr, aOldSel );
lcl_Replace( pTableView, aNewStr, aOldSel );
+ aSet.Put( SvxColorItem( Color( nNewColor ), EE_CHAR_COLOR ) );
+ pEngine->QuickSetAttribs( aSet, aOldSel );
bInRangeUpdate = true;
DataChanged();
@@ -361,6 +365,7 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
pData->aRef = rNew;
pData->nSelEnd = pData->nSelEnd + nDiff;
+ pData->nColorData = nNewColor;
sal_uInt16 nCount = (sal_uInt16) pRangeFindList->Count();
for (sal_uInt16 i=nIndex+1; i<nCount; i++)
@@ -369,6 +374,9 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew )
pNext->nSelStart = pNext->nSelStart + nDiff;
pNext->nSelEnd = pNext->nSelEnd + nDiff;
}
+
+ EditView* pActiveView = pTopView ? pTopView : pTableView;
+ pActiveView->ShowCursor( false, true );
}
else
{
diff --git a/sc/source/ui/app/rfindlst.cxx b/sc/source/ui/app/rfindlst.cxx
index 90c426e..59c63f5 100644
--- a/sc/source/ui/app/rfindlst.cxx
+++ b/sc/source/ui/app/rfindlst.cxx
@@ -18,6 +18,7 @@
*/
#include "rfindlst.hxx"
+#include <tools/debug.hxx>
// STATIC DATA -----------------------------------------------------------
@@ -29,22 +30,24 @@ static const ColorData aColNames[SC_RANGECOLORS] =
ScRangeFindList::ScRangeFindList(const OUString& rName) :
aDocName( rName ),
- bHidden( false )
+ bHidden( false ),
+ nIndexColor( 0 )
{
}
ColorData ScRangeFindList::Insert( const ScRangeFindData &rNew )
{
- for(std::vector<ScRangeFindData>::iterator it=maEntries.begin(); it!=maEntries.end(); ++it)
+ std::vector<ScRangeFindData>::iterator it=maEntries.begin();
+ for( ; it!=maEntries.end(); ++it)
{
if(it->aRef == rNew.aRef)
- {
- return it->nColorData;
- }
+ break;
}
ScRangeFindData insertData(rNew);
- insertData.nColorData = aColNames[maEntries.size() % SC_RANGECOLORS];
+ insertData.nColorData = ( it != maEntries.end() ? it->nColorData :
+ ScRangeFindList::GetColorName( maEntries.size() ) );
maEntries.push_back(insertData);
+ nIndexColor = maEntries.size() - 1;
return insertData.nColorData;
}
@@ -53,4 +56,41 @@ ColorData ScRangeFindList::GetColorName( const size_t nIndex )
return aColNames[nIndex % SC_RANGECOLORS];
}
+ColorData ScRangeFindList::FindColor( const ScRange& rRef, const size_t nIndex )
+{
+ sal_Int32 nOldCntr = 0;
+ sal_Int32 nNewCntr = 0;
+ ColorData nOldColor = 0;
+ ColorData nNewColor = 0;
+
+ DBG_ASSERT( (nIndex < maEntries.size()), "nIndex out of range!" );
+
+ nOldColor = maEntries[nIndex].nColorData;
+ nNewColor = ScRangeFindList::GetColorName( nIndex );
+
+ std::vector<ScRangeFindData>::iterator it=maEntries.begin();
+ for( ;it!=maEntries.end(); ++it)
+ {
+ if(it->aRef == rRef)
+ break;
+
+ if (it->nColorData == nOldColor )
+ nOldCntr++;
+
+ if (it->nColorData == nNewColor )
+ nNewCntr++;
+ }
+
+ if ( it != maEntries.end() )
+ return it->nColorData;
+
+ if ( nOldCntr == 1 )
+ return nOldColor;
+
+ if ( nNewCntr > 0 )
+ return ScRangeFindList::GetColorName( ++nIndexColor );
+
+ return nNewColor;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/rfindlst.hxx b/sc/source/ui/inc/rfindlst.hxx
index 7159b10..80aaecf 100644
--- a/sc/source/ui/inc/rfindlst.hxx
+++ b/sc/source/ui/inc/rfindlst.hxx
@@ -41,6 +41,7 @@ class ScRangeFindList
std::vector<ScRangeFindData> maEntries;
OUString aDocName;
bool bHidden;
+ sal_uInt16 nIndexColor;
public:
ScRangeFindList(const OUString& rName);
@@ -56,6 +57,7 @@ public:
bool IsHidden() const { return bHidden; }
static ColorData GetColorName(const size_t nIndex);
+ ColorData FindColor(const ScRange& rRef, const size_t nIndex);
};
#endif
commit 997195580a4436409c752a357391107ffd91119e
Author: Henry Castro <hcvcastro at gmail.com>
Date: Sun Feb 22 19:30:42 2015 -0400
Resolves tdf#71095 Calc doesn't paste images copied from some web browsers
Fixed. When I try to paste an web image copied from web browser, it paste now
Reviewed-on: https://gerrit.libreoffice.org/14529
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
(cherry picked from commit b05330c64799067ca2e0b8ea8bfdee8ce8b023b2)
Signed-off-by: Andras Timar <andras.timar at collabora.com>
Conflicts:
sc/source/ui/view/viewfun3.cxx
Change-Id: I696feb3438022b506303b2f354ac9c4d306e08f4
diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx
index 562135a..ecff06e 100644
--- a/sc/source/ui/view/viewfun3.cxx
+++ b/sc/source/ui/view/viewfun3.cxx
@@ -475,80 +475,112 @@ void ScViewFunc::PasteFromSystem()
sal_uLong nBiff8 = SotExchange::RegisterFormatName(OUString("Biff8"));
sal_uLong nBiff5 = SotExchange::RegisterFormatName(OUString("Biff5"));
- // als erstes SvDraw-Model, dann Grafik
- // (Grafik darf nur bei einzelner Grafik drinstehen)
-
- if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ))
+ sal_uInt16 nDestination = EXCHG_DEST_SCDOC_FREE_AREA;
+ sal_uInt16 nSourceOptions = EXCHG_IN_ACTION_COPY;
+ sal_uLong nFormat; // output param for GetExchangeAction
+ sal_uInt16 nEventAction; // output param for GetExchangeAction
+
+ uno::Reference<com::sun::star::datatransfer::XTransferable> xTransferable( aDataHelper.GetXTransferable() );
+ sal_uInt16 nAction = SotExchange::GetExchangeAction(
+ aDataHelper.GetDataFlavorExVector(),
+ nDestination,
+ nSourceOptions,
+ EXCHG_IN_ACTION_DEFAULT,
+ nFormat, nEventAction, 0,
+ &xTransferable );
+
+ if ( nAction != EXCHG_INOUT_ACTION_NONE )
{
- // special case for tables from drawing
- if( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
- {
- PasteFromSystem( FORMAT_RTF );
- }
- else
+ nAction = ( nAction & EXCHG_ACTION_MASK );
+
+ switch( nAction )
{
- PasteFromSystem( SOT_FORMATSTR_ID_DRAWING );
+ case EXCHG_OUT_ACTION_INSERT_SVXB:
+ case EXCHG_OUT_ACTION_INSERT_GDIMETAFILE:
+ case EXCHG_OUT_ACTION_INSERT_BITMAP:
+ case EXCHG_OUT_ACTION_INSERT_GRAPH:
+ // FORMAT_BITMAP
+ // SOT_FORMATSTR_ID_PNG
+ // FORMAT_GDIMETAFILE
+ // SOT_FORMATSTR_ID_SVXB
+ PasteFromSystem(nFormat);
+ break;
+ default:
+ nAction = EXCHG_INOUT_ACTION_NONE;
}
}
- else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_SVXB ))
- PasteFromSystem( SOT_FORMATSTR_ID_SVXB );
- else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ))
- {
- // If it's a Writer object, insert RTF instead of OLE
- // Else, if the class id is all-zero, and SYLK is available,
- // it probably is spreadsheet cells that have been put
- // on the clipboard by OOo, so use the SYLK. (fdo#31077)
+ if ( nAction == EXCHG_INOUT_ACTION_NONE )
+ {
+ // first SvDraw-model, then drawing
+ // (only one drawing is allowed)
- bool bDoRtf = false;
- TransferableObjectDescriptor aObjDesc;
- if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
+ if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_DRAWING ))
{
- bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) ||
- aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) )
- && aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
+ // special case for tables from drawing
+ if( aDataHelper.HasFormat( SOT_FORMAT_RTF ) )
+ {
+ PasteFromSystem( FORMAT_RTF );
+ }
+ else
+ {
+ PasteFromSystem( SOT_FORMATSTR_ID_DRAWING );
+ }
}
- if ( bDoRtf )
- PasteFromSystem( FORMAT_RTF );
- else if ( aObjDesc.maClassName == SvGlobalName( 0,0,0,0,0,0,0,0,0,0,0 )
- && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SYLK ))
- PasteFromSystem( SOT_FORMATSTR_ID_SYLK );
- else
- PasteFromSystem( SOT_FORMATSTR_ID_EMBED_SOURCE );
+ else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE ))
+ {
+ // If it's a Writer object, insert RTF instead of OLE
+
+ // Else, if the class id is all-zero, and SYLK is available,
+ // it probably is spreadsheet cells that have been put
+ // on the clipboard by OOo, so use the SYLK. (fdo#31077)
+
+ bool bDoRtf = false;
+ TransferableObjectDescriptor aObjDesc;
+ if( aDataHelper.GetTransferableObjectDescriptor( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aObjDesc ) )
+ {
+ bDoRtf = ( ( aObjDesc.maClassName == SvGlobalName( SO3_SW_CLASSID ) ||
+ aObjDesc.maClassName == SvGlobalName( SO3_SWWEB_CLASSID ) )
+ && aDataHelper.HasFormat( SOT_FORMAT_RTF ) );
+ }
+ if ( bDoRtf )
+ PasteFromSystem( FORMAT_RTF );
+ else if ( aObjDesc.maClassName == SvGlobalName( 0,0,0,0,0,0,0,0,0,0,0 )
+ && aDataHelper.HasFormat( SOT_FORMATSTR_ID_SYLK ))
+ PasteFromSystem( SOT_FORMATSTR_ID_SYLK );
+ else
+ PasteFromSystem( SOT_FORMATSTR_ID_EMBED_SOURCE );
+ }
+ else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK_SOURCE ))
+ PasteFromSystem( SOT_FORMATSTR_ID_LINK_SOURCE );
+ // the following format can not affect scenario from #89579#
+ else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ))
+ PasteFromSystem( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE );
+ // FORMAT_PRIVATE no longer here (can't work if pOwnClip is NULL)
+ else if (aDataHelper.HasFormat(nBiff8)) // before xxx_OLE formats
+ PasteFromSystem(nBiff8);
+ else if (aDataHelper.HasFormat(nBiff5))
+ PasteFromSystem(nBiff5);
+ else if (aDataHelper.HasFormat(FORMAT_RTF))
+ PasteFromSystem(FORMAT_RTF);
+ else if (aDataHelper.HasFormat(SOT_FORMATSTR_ID_HTML))
+ PasteFromSystem(SOT_FORMATSTR_ID_HTML);
+ else if (aDataHelper.HasFormat(SOT_FORMATSTR_ID_HTML_SIMPLE))
+ PasteFromSystem(SOT_FORMATSTR_ID_HTML_SIMPLE);
+ else if (aDataHelper.HasFormat(SOT_FORMATSTR_ID_SYLK))
+ PasteFromSystem(SOT_FORMATSTR_ID_SYLK);
+ else if (aDataHelper.HasFormat(FORMAT_STRING))
+ PasteFromSystem(FORMAT_STRING);
+ // xxx_OLE formats come last, like in SotExchange tables
+ else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ))
+ PasteFromSystem( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE );
+ else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK_SOURCE_OLE ))
+ PasteFromSystem( SOT_FORMATSTR_ID_LINK_SOURCE_OLE );
}
- else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK_SOURCE ))
- PasteFromSystem( SOT_FORMATSTR_ID_LINK_SOURCE );
- // the following format can not affect scenario from #89579#
- else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ))
- PasteFromSystem( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE );
- // FORMAT_PRIVATE no longer here (can't work if pOwnClip is NULL)
- else if (aDataHelper.HasFormat(nBiff8)) // before xxx_OLE formats
- PasteFromSystem(nBiff8);
- else if (aDataHelper.HasFormat(nBiff5))
- PasteFromSystem(nBiff5);
- else if (aDataHelper.HasFormat(FORMAT_RTF))
- PasteFromSystem(FORMAT_RTF);
- else if (aDataHelper.HasFormat(SOT_FORMATSTR_ID_HTML))
- PasteFromSystem(SOT_FORMATSTR_ID_HTML);
- else if (aDataHelper.HasFormat(SOT_FORMATSTR_ID_HTML_SIMPLE))
- PasteFromSystem(SOT_FORMATSTR_ID_HTML_SIMPLE);
- else if (aDataHelper.HasFormat(SOT_FORMATSTR_ID_SYLK))
- PasteFromSystem(SOT_FORMATSTR_ID_SYLK);
- else if (aDataHelper.HasFormat(FORMAT_STRING))
- PasteFromSystem(FORMAT_STRING);
- else if (aDataHelper.HasFormat(FORMAT_GDIMETAFILE))
- PasteFromSystem(FORMAT_GDIMETAFILE);
- else if (aDataHelper.HasFormat(FORMAT_BITMAP))
- PasteFromSystem(FORMAT_BITMAP);
- // xxx_OLE formats come last, like in SotExchange tables
- else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ))
- PasteFromSystem( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE );
- else if (aDataHelper.HasFormat( SOT_FORMATSTR_ID_LINK_SOURCE_OLE ))
- PasteFromSystem( SOT_FORMATSTR_ID_LINK_SOURCE_OLE );
}
}
- // keine Fehlermeldung, weil SID_PASTE in der idl das FastCall-Flag hat,
- // also auch gerufen wird, wenn nichts im Clipboard steht (#42531#)
+ // no exception-> SID_PASTE has FastCall-flag from idl
+ // will be called in case of empty clipboard (#42531#)
}
void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTransferable>& rxTransferable )
More information about the Libreoffice-commits
mailing list