Translation of libreoffice/core/plain/svx/source/fmcomp/fmgridcl.cxx

Rogier Brussee rogier.brussee at gmail.com
Mon Apr 10 19:32:49 UTC 2017


As far as I know the file

libreoffice/core/plain/svx/source/fmcomp/fmgridcl.cxx

has not been translated yet.

Below is a  diff of the original file and the translation.  I don't have
the whole tree and just downloaded the file from the web interface, so I
also include the edited file.

Yours,

 Rogier Brussee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170410/0c2f37c6/attachment.html>
-------------- next part --------------
--- libreoffice/core/plain/svx/source/fmcomp/a/fmgridcl.cxx	2017-04-10 17:21:00.000000000 +0200
+++ libreoffice/core/plain/svx/source/fmcomp/b/fmgridcl.cxx	2017-04-10 18:04:35.000000000 +0200
@@ -403,17 +403,17 @@
         {
             ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
             ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
             return;
         }
-
-        // Vom Feld werden nun zwei Informationen benoetigt:
-        // a.) Name des Feldes fuer Label und ControlSource
-        // b.) FormatKey, um festzustellen, welches Feld erzeugt werden soll
+        
+        // We now need two pieces of information from the field:
+        // a) The name of the field for Label and ControlSource
+        // b) Formatkey so that we know what kind of field has to be created.
         sal_Int32 nDataType = 0;
         xField->getPropertyValue(FM_PROP_FIELDTYPE) >>= nDataType;
-        // diese Datentypen koennen im Gridcontrol nicht verarbeitet werden
+        // These Datatypes cannot be used for Gridcontrol
         switch (nDataType)
         {
             case DataType::BLOB:
             case DataType::LONGVARBINARY:
             case DataType::BINARY:
@@ -421,17 +421,16 @@
             case DataType::OTHER:
                 ::comphelper::disposeComponent(m_pImpl->xDroppedResultSet);
                 ::comphelper::disposeComponent(m_pImpl->xDroppedStatement);
                 return;
         }
-
-        // Erstellen der Column
+        // Creation of the column
         Reference< XIndexContainer >  xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
         Reference< XGridColumnFactory >  xFactory(xCols, UNO_QUERY);
 
         sal_uInt16 nColId = GetItemId(m_pImpl->aDropPosPixel);
-        // EinfuegePosition, immer vor der aktuellen Spalte
+        // Insertion position always before the current column
         sal_uInt16 nPos = GetModelColumnPos(nColId);
         Reference< XPropertySet >  xCol, xSecondCol;
 
         // Create Column based on type, default textfield
         std::vector<sal_uInt16> aPossibleTypes;
@@ -562,11 +561,11 @@
             xSecondCol->setPropertyValue(FM_PROP_LABEL, makeAny( OUString( sFieldName + sDatePostfix ) ) );
         }
         else
             xCol->setPropertyValue(FM_PROP_LABEL, makeAny(sFieldName));
 
-        // jetzt einfuegen
+        // Now insert
         Any aElement;
         aElement <<= xCol;
 
         xCols->insertByIndex(nPos, aElement);
 
@@ -607,12 +606,12 @@
         if (bDateNTimeCol)
         {
             aElement <<= xSecondCol;
             xCols->insertByIndex(nPos == (sal_uInt16)-1 ? nPos : ++nPos, aElement);
         }
-
-        // ist die component::Form an die Datenbankangebunden?
+        
+        // is the component::Form connected to the current database
         Reference< XFormComponent >  xFormCp(xCols, UNO_QUERY);
         Reference< XPropertySet >  xForm(xFormCp->getParent(), UNO_QUERY);
         if (xForm.is())
         {
             if (::comphelper::getString(xForm->getPropertyValue(FM_PROP_DATASOURCE)).isEmpty())
@@ -659,11 +658,11 @@
 void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMenu)
 {
     bool bDesignMode = static_cast<FmGridControl*>(GetParent())->IsDesignMode();
 
     Reference< css::container::XIndexContainer >  xCols(static_cast<FmGridControl*>(GetParent())->GetPeer()->getColumns());
-    // Aufbau des Insert Menus
+    // Build the insert menus
     // mark the column if nColId != HEADERBAR_ITEM_NOTFOUND
     if(nColId > 0)
     {
         sal_uInt16 nPos2 = GetModelColumnPos(nColId);
 
@@ -672,11 +671,11 @@
         Reference< css::view::XSelectionSupplier >    xSelSupplier(xColumns, UNO_QUERY);
         if (xSelSupplier.is())
             xSelSupplier->select(makeAny(xColumn));
     }
 
-    // EinfuegePosition, immer vor der aktuellen Spalte
+    // Insertion always before the current column
     sal_uInt16 nPos = GetModelColumnPos(nColId);
     bool bMarked = nColId && static_cast<FmGridControl*>(GetParent())->isColumnMarked(nColId);
 
     VclPtrInstance<PopupMenu> pControlMenu;
 
@@ -940,11 +939,11 @@
             Reference< XGridColumnFactory > xFactory( xCols, UNO_QUERY_THROW );
             Reference< XPropertySet > xNewCol( xFactory->createColumn( aFieldType ), UNO_SET_THROW );
 
             if ( bReplace )
             {
-                // ein paar Properties hinueberretten
+                // save a few Properties here
                 Reference< XPropertySet > xReplaced( xCols->getByIndex( nPos ), UNO_QUERY );
 
                 TransferFormComponentProperties(
                     xReplaced, xNewCol, Application::GetSettings().GetUILanguageTag().getLocale() );
 
@@ -1051,11 +1050,12 @@
 {
     if ( CommandEventId::ContextMenu == _rEvt.GetCommand() )
     {
         FmGridHeader* pMyHeader = static_cast< FmGridHeader* >( GetHeaderBar() );
         if ( pMyHeader && !_rEvt.IsMouseEvent() )
-        {   // context menu requested by keyboard
+        {
+            // context menu requested by keyboard
             if  ( 1 == GetSelectColumnCount() || IsDesignMode() )
             {
                 sal_uInt16 nSelId = GetColumnId(
                     sal::static_int_cast< sal_uInt16 >( FirstSelectedColumn() ) );
                 ::tools::Rectangle aColRect( GetFieldRectPixel( 0, nSelId, false ) );
@@ -1081,11 +1081,11 @@
         implAdjustInSolarThread(true);
         return;
     }
 
     const DbGridRowRef& xRow = GetCurrentRow();
-    // waehrend Positionierung wird kein abgleich  der Properties vorgenommen
+    // while positioning we do not adjust the Properties
     Reference<XPropertySet> xSet(evt.Source,UNO_QUERY);
     if (xRow.is() && (::cppu::any2bool(xSet->getPropertyValue(FM_PROP_ISNEW))|| CompareBookmark(getDataSource()->getBookmark(), xRow->GetBookmark())))
     {
         if (evt.PropertyName == FM_PROP_ISMODIFIED)
         {
@@ -1107,11 +1107,11 @@
     DbGridControl::SetDesignMode(bMode);
     if (bOldMode != bMode)
     {
         if (!bMode)
         {
-            // selection aufheben
+            // deselect
             markColumn(USHRT_MAX);
         }
         else
         {
             Reference< css::container::XIndexContainer >  xColumns(GetPeer()->getColumns());
@@ -1143,11 +1143,11 @@
         return;
 
     // how many rows are selected?
     sal_Int32 nSelectedRows = GetSelectRowCount();
 
-    // the current line should be deleted but it is currently in edit mode
+    // the current row should be deleted but it is currently in edit mode
     if ( IsCurrentAppending() )
         return;
     // is the insert row selected
     if (GetEmptyRow().is() && IsRowSelected(GetRowCount() - 1))
         nSelectedRows -= 1;
@@ -1198,11 +1198,11 @@
         }
         catch(const Exception&)
         {
             OSL_FAIL("Exception caught while deleting rows!");
         }
-        // An den DatenCursor anpassen
+        // Adjust for the data cursor
         AdjustDataSource(true);
         EndCursorAction();
         SetUpdateMode(true);
     }
     else
@@ -1252,13 +1252,13 @@
                     bNewPos = true;
                     aBookmark = m_pSeekCursor->getBookmark();
                 }
             }
         }
-
-        // Sind alle Zeilen Selectiert
-        // Zweite bedingung falls keine einguegeZeile existiert
+        
+        // Are all rows selected?
+        // The second condition is valid when no insertion row exists.
         bool bAllSelected = GetTotalCount() == nSelectedRows || GetRowCount() == nSelectedRows;
 
         BeginCursorAction();
 
         // now delete the row
@@ -1279,12 +1279,12 @@
         for (sal_Int32 i = 0; i < aDeletedRows.getLength(); i++)
         {
             if (pSuccess[i])
                 ++nDeletedRows;
         }
-
-        // sind Zeilen geloescht worden?
+        
+        // have rows been deleted?
         if (nDeletedRows)
         {
             SetUpdateMode(false);
             SetNoSelection();
             try
@@ -1347,15 +1347,15 @@
                 catch(const Exception&)
                 {
                 }
             }
 
-            // An den DatenCursor anpassen
+            // adjust for the data cursor
             AdjustDataSource(true);
-
-            // es konnten nicht alle Zeilen geloescht werden
-            // da nie nicht geloeschten wieder selektieren
+            
+            
+            // Not all rows could be deleted since we never re-select the non deleted ones
             if (nDeletedRows < nSelectedRows)
             {
                 // waren alle selektiert
                 if (bAllSelected)
                 {
@@ -1387,11 +1387,11 @@
             }
 
             EndCursorAction();
             SetUpdateMode(true);
         }
-        else // Zeile konnte nicht geloescht werden
+        else // row could not be deleted
         {
             EndCursorAction();
             try
             {
                 // currentrow is the insert row?
@@ -1417,12 +1417,11 @@
     implAdjustInSolarThread(false);
 }
 
 bool FmGridControl::commit()
 {
-    // Commit nur ausfuehren, wenn nicht bereits ein Update vom css::form::component::GridControl ausgefuehrt
-    // wird
+    // Only do the commit when an update of css::form::component::GridControl is executing.
     if (!IsUpdating())
     {
         if (Controller().is() && Controller()->IsModified())
         {
             if (!SaveModified())
@@ -1436,11 +1435,11 @@
 {
     const DbGridRowRef& xRow = GetCurrentRow();
     if (!xRow.is())
         return;
 
-    // Zeile ist eingefuegt worden, dann den status und mode zuruecksetzen
+    // The row has been inserted. Reset status and mode to its original value.
     xRow->SetState(m_pDataCursor, false);
     xRow->SetNew(false);
 
 }
 
@@ -1452,11 +1451,11 @@
 
 void FmGridControl::markColumn(sal_uInt16 nId)
 {
     if (GetHeaderBar() && m_nMarkedColumnId != nId)
     {
-        // deselektieren
+        // deselect
         if (m_nMarkedColumnId != BROWSER_INVALIDID)
         {
             HeaderBarItemBits aBits = GetHeaderBar()->GetItemBits(m_nMarkedColumnId) & ~HeaderBarItemBits::FLAT;
             GetHeaderBar()->SetItemBits(m_nMarkedColumnId, aBits);
         }
@@ -1506,19 +1505,19 @@
 
 void FmGridControl::ColumnResized(sal_uInt16 nId)
 {
     DbGridControl::ColumnResized(nId);
 
-    // Wert ans model uebergeben
+    // Hand over the value to the model
     DbGridColumn* pCol = DbGridControl::GetColumns().at( GetModelColumnPos(nId) );
     Reference< css::beans::XPropertySet >  xColModel(pCol->getModel());
     if (xColModel.is())
     {
         Any aWidth;
         sal_Int32 nColumnWidth = GetColumnWidth(nId);
         nColumnWidth = CalcReverseZoom(nColumnWidth);
-        // Umrechnen in 10THMM
+        // Convert to 10THMM
         aWidth <<= (sal_Int32)PixelToLogic(Point(nColumnWidth,0),MapUnit::Map10thMM).X();
         xColModel->setPropertyValue(FM_PROP_WIDTH, aWidth);
     }
 }
 
@@ -1547,16 +1546,15 @@
     DbGridControl::ColumnMoved(nId);
     Reference< css::container::XIndexContainer >  xColumns(GetPeer()->getColumns());
 
     if (xColumns.is())
     {
-        // suchen der Spalte und verschieben im Model
-        // ColumnPos holen
+        // Find the column and shift the model
         DbGridColumn* pCol = DbGridControl::GetColumns().at( GetModelColumnPos(nId) );
         Reference< css::beans::XPropertySet >  xCol;
-
-        // Einfuegen muss sich an den Column Positionen orientieren
+        
+        // Insertion must be done relative to the column positions
         sal_Int32 i;
         Reference< XInterface > xCurrent;
         for (i = 0; !xCol.is() && i < xColumns->getCount(); i++)
         {
             xCurrent.set(xColumns->getByIndex(i), css::uno::UNO_QUERY);
@@ -1581,12 +1579,11 @@
     m_bInColumnMove = false;
 }
 
 void FmGridControl::InitColumnsByModels(const Reference< css::container::XIndexContainer >& xColumns)
 {
-    // Spalten wieder neu setzen
-    // wenn es nur eine HandleColumn gibt, dann nicht
+    // Reset the columns, unless there is only one HandleColumn
     if (GetModelColCount())
     {
         RemoveColumns();
         InsertHandleColumn();
     }
@@ -1594,11 +1591,11 @@
     if (!xColumns.is())
         return;
 
     SetUpdateMode(false);
 
-    // Einfuegen muss sich an den Column Positionen orientieren
+    // Insertion must be done relative to the column positions
     sal_Int32 i;
     Any aWidth;
     for (i = 0; i < xColumns->getCount(); ++i)
     {
         Reference< css::beans::XPropertySet > xCol(
@@ -1615,14 +1612,15 @@
         AppendColumn(aName, (sal_uInt16)nWidth);
         DbGridColumn* pCol = DbGridControl::GetColumns().at( i );
         pCol->setModel(xCol);
     }
 
-    // und jetzt noch die hidden columns rausnehmen
-    // (wir haben das nicht gleich in der oberen Schleife gemacht, da wir dann Probleme mit den
-    // IDs der Spalten bekommen haetten : AppendColumn vergibt die automatisch, die Spalte _nach_
-    // einer versteckten braucht aber eine um eine erhoehte ID ....
+    // Now just remove the hidden columns.
+    // Note: we did not do this in the previous loop , since we would have gotten problems with 
+    // the ID in the columns. AppendColumn hands out the (translator: correct) one automatically; the ID of the 
+    // row _after_ a hidden one, however, has to be incremented by one. 
+   
     Any aHidden;
     for (i = 0; i < xColumns->getCount(); ++i)
     {
         Reference< css::beans::XPropertySet > xCol( xColumns->getByIndex(i), css::uno::UNO_QUERY);
         aHidden = xCol->getPropertyValue(FM_PROP_HIDDEN);
@@ -1708,15 +1706,15 @@
 void FmGridControl::InitColumnsByFields(const Reference< css::container::XIndexAccess >& _rxFields)
 {
     if ( !_rxFields.is() )
         return;
 
-    // Spalten initialisieren
+    // Initialise columns
     Reference< XIndexContainer > xColumns( GetPeer()->getColumns() );
     Reference< XNameAccess > xFieldsAsNames( _rxFields, UNO_QUERY );
 
-    // Einfuegen muss sich an den Column Positionen orientieren
+    // Insertion must be done relative to the column positions
     for (sal_Int32 i = 0; i < xColumns->getCount(); i++)
     {
         DbGridColumn* pCol = GetColumns().at( i );
         OSL_ENSURE(pCol,"No grid column!");
         if ( pCol )
@@ -1777,13 +1775,13 @@
         markColumn(nId); // ... -> mark it
 }
 
 bool FmGridControl::selectBookmarks(const Sequence< Any >& _rBookmarks)
 {
+    // need to lock the SolarMutex so that no paint call disturbs us ...
     SolarMutexGuard aGuard;
-        // need to lock the SolarMutex so that no paint call disturbs us ...
-
+    
     if ( !m_pSeekCursor )
     {
         OSL_FAIL( "FmGridControl::selectBookmarks: no seek cursor!" );
         return false;
     }
@@ -1852,17 +1850,17 @@
         for (i=0; i<nSelectedRows; ++i)
         {
             nIdx = ::comphelper::getINT32(pBookmarks[i]);
             if (IsInsertionRow(nIdx))
             {
-                // leerzeile nicht loeschen
+                // donot delete empty row
                 aBookmarks.realloc(--nSelectedRows);
-                SelectRow(nIdx, false);          // selection aufheben fuer leerzeile
+                SelectRow(nIdx, false);          // remove the selection for an empty row
                 break;
             }
-
-            // Zunaechst den DatenCursor auf den selektierten Satz pos.
+            
+            // Next, the data cursor at the selected row position.
             if (SeekCursor(nIdx))
             {
                 GetSeekRow()->SetState(m_pSeekCursor, true);
 
                 pBookmarks[i] = m_pSeekCursor->getBookmark();
@@ -1976,19 +1974,20 @@
 }
 
 void FmGridControl::Select()
 {
     DbGridControl::Select();
-    // ... betrifft das unsere Spalten ?
+    // are we dealing with our column?
     const MultiSelection* pColumnSelection = GetColumnSelection();
 
     sal_uInt16 nSelectedColumn =
         pColumnSelection && pColumnSelection->GetSelectCount()
             ? sal::static_int_cast< sal_uInt16 >(
                 const_cast<MultiSelection*>(pColumnSelection)->FirstSelected())
             : SAL_MAX_UINT16;
-    // die HandleColumn wird nicht selektiert
+
+    // the HandleColumn is not selected. 
     switch (nSelectedColumn)
     {
         case SAL_MAX_UINT16: break; // no selection
         case  0 : nSelectedColumn = SAL_MAX_UINT16; break;
                     // handle col can't be selected
@@ -1998,11 +1997,11 @@
             break;
     }
 
     if (nSelectedColumn != m_nCurrentSelectedColumn)
     {
-        // VOR dem Aufruf des select am SelectionSupplier !
+        // _Before_ the call of select on the SelectionSupplier !
         m_nCurrentSelectedColumn = nSelectedColumn;
 
         if (!m_bSelecting)
         {
             m_bSelecting = true;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fmgridcl.cxx
Type: application/octet-stream
Size: 80188 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20170410/0c2f37c6/attachment.obj>


More information about the LibreOffice mailing list